0.4.0 • Published 4 years ago

nswagjs v0.4.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

NSwag.JS

JavaScript API for NSwag - The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.

Example

const nswag = new NSwag(NSwag.getCoreVersion())

</details>

**Importing NSwag**
```typescript
import NSwag from 'nswagjs'

const nswag = new NSwag('./node_modules/nswag', NSwag.getCoreVersion())

Executing a .nswag configuration document by using the run method

// path to *.nswag or nswag.json file
await nswag.run(path.join(__dirname, 'main.nswag'), {
	input: {
		path: path.join(__dirname, 'main.openapi.json'), // same as url, can be undefined
		json: data // optional string, required if path/url is undefined
	},
	outputs: {
		// path to generated file
		'openApiToTypeScriptClient': path.join(__dirname, 'generated/run.test.ts')
	}
})

Using openapi2tsclient generator

await nswag.openapi2tsclient(path.join(__dirname, 'main.openapi.json'), path.join(__dirname, 'generated/run.test.ts'))

Useful tools

@accility/protoc-swagger-plugin — Protocol Buffer to Swagger/OpenAPI plguin for @accility/protoc-tools.

Upcoming updates

  • Support for the openapi2csclient, .NET Swagger Generator, and JSON Schema Converters will be implemented in v2.0.

Support for swagger generators is not going to be implemented due to the deprication.

License

This project is licensed under MIT.

0.4.0

4 years ago

0.3.0

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago