from Hacker News

Show HN: Auto-generate ASP.NET Core servers stub for REST APIs

by wing328hk on 5/5/20, 4:07 AM with 0 comments

We've added ASP.NET Core 3.1 & 3.0 support to OpenAPI Generator (https://github.com/OpenAPITools/openapi-generator). To generate the ASP.NET Core server stub given an OpenAPI/Swagger specification file, please follow 3 simple steps below:

1. Download the Java JAR (https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.3.1-SNAPSHOT/openapi-generator-cli-4.3.1-20200505.035216-173.jar)

2. Rename the JAR as "openapi-generator-cli.jar"

3. Run the following command to generate a ASP.NET Core server stub for the Petstore API (https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml):

Mac/Linux:

- java -jar openapi-generator-cli.jar generate -g aspnetcore -i https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o /var/tmp/aspnetcore31/ --additional-properties aspnetCoreVersion=3.1

Windows:

- java -jar openapi-generator-cli.jar generate -g aspnetcore -i https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o C:\tmp\aspnetcore31 --additional-properties aspnetCoreVersion=3.1

Thanks Paul Hatcher (https://github.com/phatcher) for contributing the enhancement (https://github.com/OpenAPITools/openapi-generator/pull/6025).

If you've any feedback or question, please let us know via https://github.com/OpenAPITools/openapi-generator/issues/new.