-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): generate typescript models from swagger/openapi project (#…
…447) This is experimental, and currently disabled by default.
- Loading branch information
1 parent
e4365a9
commit cd56d1c
Showing
96 changed files
with
3,905 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"version": 1, | ||
"isRoot": true, | ||
"tools": { | ||
"swashbuckle.aspnetcore.cli": { | ||
"version": "6.2.3", | ||
"commands": ["swagger"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"nugetPackages": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"@nrwl/react/babel", | ||
{ | ||
"runtime": "automatic" | ||
} | ||
] | ||
], | ||
"plugins": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# This file is used by: | ||
# 1. autoprefixer to adjust CSS to support the below specified browsers | ||
# 2. babel preset-env to adjust included polyfills | ||
# | ||
# For additional information regarding the format and rule options, please see: | ||
# https://github.com/browserslist/browserslist#queries | ||
# | ||
# If you need to support different browsers in production, you may tweak the list below. | ||
|
||
last 1 Chrome version | ||
last 1 Firefox version | ||
last 2 Edge major versions | ||
last 2 Safari major version | ||
last 2 iOS major versions | ||
Firefox ESR | ||
not IE 9-11 # For IE 9-11 support, remove 'not'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"extends": ["plugin:@nrwl/nx/react", "../../../.eslintrc.json"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"rules": {} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* eslint-disable */ | ||
export default { | ||
displayName: 'demo-web-frontend', | ||
preset: '../../../jest.preset.js', | ||
transform: { | ||
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest', | ||
'^.+\\.[tj]sx?$': 'babel-jest', | ||
}, | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], | ||
coverageDirectory: '../../coverage//demo/apps/web-frontend', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
{ | ||
"$schema": "../../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "demo/apps/web-frontend/src", | ||
"projectType": "application", | ||
"targets": { | ||
"build": { | ||
"executor": "@nrwl/web:webpack", | ||
"outputs": ["{options.outputPath}"], | ||
"defaultConfiguration": "production", | ||
"options": { | ||
"compiler": "babel", | ||
"outputPath": "dist/demo/apps/web-frontend", | ||
"index": "demo/apps/web-frontend/src/index.html", | ||
"baseHref": "/", | ||
"main": "demo/apps/web-frontend/src/main.tsx", | ||
"polyfills": "demo/apps/web-frontend/src/polyfills.ts", | ||
"tsConfig": "demo/apps/web-frontend/tsconfig.app.json", | ||
"assets": [ | ||
"demo/apps/web-frontend/src/favicon.ico", | ||
"demo/apps/web-frontend/src/assets" | ||
], | ||
"styles": ["demo/apps/web-frontend/src/styles.scss"], | ||
"scripts": [], | ||
"webpackConfig": "@nrwl/react/plugins/webpack" | ||
}, | ||
"configurations": { | ||
"production": { | ||
"fileReplacements": [ | ||
{ | ||
"replace": "demo/apps/web-frontend/src/environments/environment.ts", | ||
"with": "demo/apps/web-frontend/src/environments/environment.prod.ts" | ||
} | ||
], | ||
"optimization": true, | ||
"outputHashing": "all", | ||
"sourceMap": false, | ||
"namedChunks": false, | ||
"extractLicenses": true, | ||
"vendorChunk": false | ||
}, | ||
"development": { | ||
"extractLicenses": false, | ||
"optimization": false, | ||
"sourceMap": true, | ||
"vendorChunk": true | ||
} | ||
} | ||
}, | ||
"serve": { | ||
"executor": "@nrwl/web:dev-server", | ||
"options": { | ||
"buildTarget": "demo-web-frontend:build", | ||
"hmr": true | ||
}, | ||
"configurations": { | ||
"production": { | ||
"buildTarget": "demo-web-frontend:build:production", | ||
"hmr": false | ||
}, | ||
"development": { | ||
"buildTarget": "demo-web-frontend:build:development" | ||
} | ||
}, | ||
"defaultConfiguration": "development" | ||
}, | ||
"lint": { | ||
"executor": "@nrwl/linter:eslint", | ||
"outputs": ["{options.outputFile}"], | ||
"options": { | ||
"lintFilePatterns": ["demo/apps/web-frontend/**/*.{ts,tsx,js,jsx}"] | ||
} | ||
}, | ||
"test": { | ||
"executor": "@nrwl/jest:jest", | ||
"outputs": ["coveragedemo/apps/web-frontend"], | ||
"options": { | ||
"jestConfig": "demo/apps/web-frontend/jest.config.ts", | ||
"passWithNoTests": true | ||
} | ||
} | ||
}, | ||
"tags": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/* Your styles goes here. */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { render } from '@testing-library/react'; | ||
|
||
import App from './app'; | ||
|
||
describe('App', () => { | ||
it('should render successfully', () => { | ||
const { baseElement } = render(<App />); | ||
|
||
expect(baseElement).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* eslint-disable @typescript-eslint/no-unused-vars */ | ||
|
||
import styles from './app.module.scss'; | ||
|
||
import { WeatherForecast } from '@nx-dotnet/demo-libs-generated-webapi-types'; | ||
|
||
const x: WeatherForecast = { | ||
date: 'TAOSNAPS', | ||
summary: 'My weather forecast', | ||
temperature: { | ||
temperatureC: 12, | ||
temperatureF: 53, | ||
}, | ||
}; | ||
|
||
export function App() { | ||
return <div />; | ||
} | ||
|
||
export default App; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const environment = { | ||
production: true, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// This file can be replaced during build by using the `fileReplacements` array. | ||
// When building for production, this file is replaced with `environment.prod.ts`. | ||
|
||
export const environment = { | ||
production: false, | ||
}; |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>DemoWebFrontend</title> | ||
<base href="/" /> | ||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<link rel="icon" type="image/x-icon" href="favicon.ico" /> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { StrictMode } from 'react'; | ||
import * as ReactDOMClient from 'react-dom/client'; | ||
|
||
import App from './app/app'; | ||
|
||
const root = ReactDOMClient.createRoot( | ||
document.getElementById('root') as HTMLElement, | ||
); | ||
|
||
root.render( | ||
<StrictMode> | ||
<App /> | ||
</StrictMode>, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** | ||
* Polyfill stable language features. These imports will be optimized by `@babel/preset-env`. | ||
* | ||
* See: https://github.com/zloirock/core-js#babel | ||
*/ | ||
import 'core-js/stable'; | ||
import 'regenerator-runtime/runtime'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/* You can add global styles to this file, and also import other style files */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../dist/out-tsc", | ||
"types": ["node"] | ||
}, | ||
"files": [ | ||
"../../../node_modules/@nrwl/react/typings/cssmodule.d.ts", | ||
"../../../node_modules/@nrwl/react/typings/image.d.ts" | ||
], | ||
"exclude": [ | ||
"**/*.spec.ts", | ||
"**/*.test.ts", | ||
"**/*.spec.tsx", | ||
"**/*.test.tsx", | ||
"**/*.spec.js", | ||
"**/*.test.js", | ||
"**/*.spec.jsx", | ||
"**/*.test.jsx", | ||
"jest.config.ts" | ||
], | ||
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"extends": "../../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"jsx": "react-jsx", | ||
"allowJs": true, | ||
"esModuleInterop": true, | ||
"allowSyntheticDefaultImports": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": true, | ||
"noImplicitOverride": true, | ||
"noPropertyAccessFromIndexSignature": true, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": true | ||
}, | ||
"files": [], | ||
"include": [], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.app.json" | ||
}, | ||
{ | ||
"path": "./tsconfig.spec.json" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../dist/out-tsc", | ||
"module": "commonjs", | ||
"types": ["jest", "node"] | ||
}, | ||
"include": [ | ||
"**/*.test.ts", | ||
"**/*.spec.ts", | ||
"**/*.test.tsx", | ||
"**/*.spec.tsx", | ||
"**/*.test.js", | ||
"**/*.spec.js", | ||
"**/*.test.jsx", | ||
"**/*.spec.jsx", | ||
"**/*.d.ts", | ||
"jest.config.ts" | ||
], | ||
"files": [ | ||
"../../../node_modules/@nrwl/react/typings/cssmodule.d.ts", | ||
"../../../node_modules/@nrwl/react/typings/image.d.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace NxDotnet.Test.Webapi.Controllers; | ||
|
||
[ApiController] | ||
[Route("[controller]")] | ||
public class WeatherForecastController : ControllerBase | ||
{ | ||
private static readonly string[] Summaries = new[] | ||
{ | ||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" | ||
}; | ||
|
||
private readonly ILogger<WeatherForecastController> _logger; | ||
|
||
public WeatherForecastController(ILogger<WeatherForecastController> logger) | ||
{ | ||
_logger = logger; | ||
} | ||
|
||
[HttpGet(Name = "GetWeatherForecast")] | ||
public IEnumerable<WeatherForecast> Get() | ||
{ | ||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast | ||
{ | ||
Date = DateTime.Now.AddDays(index), | ||
Temperature = new Temperature | ||
{ | ||
TemperatureC = Random.Shared.Next(-20, 55), | ||
}, | ||
Summary = Summaries[Random.Shared.Next(Summaries.Length)] | ||
}) | ||
.ToArray(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
|
||
<TargetFramework>net6.0</TargetFramework> | ||
|
||
<Nullable>enable</Nullable> | ||
|
||
<ImplicitUsings>enable</ImplicitUsings> | ||
|
||
<OutputPath>../../../dist/demo/apps/webapi</OutputPath> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
|
||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3"/> | ||
|
||
</ItemGroup> | ||
|
||
</Project> |
Oops, something went wrong.