forked from loafle/openapi-generator-original
fix the location of openapi.yaml/json file
This commit is contained in:
@@ -133,7 +133,7 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
|
||||
supportingFiles.add(new SupportingFile("wwwroot" + File.separator + "index.html", packageFolder + File.separator + "wwwroot", "index.html"));
|
||||
supportingFiles.add(new SupportingFile("wwwroot" + File.separator + "web.config", packageFolder + File.separator + "wwwroot", "web.config"));
|
||||
|
||||
supportingFiles.add(new SupportingFile("wwwroot" + File.separator + "swagger-original.mustache", packageFolder + File.separator + "wwwroot", "swagger-original.json"));
|
||||
supportingFiles.add(new SupportingFile("wwwroot" + File.separator + "openapi-original.mustache", packageFolder + File.separator + "wwwroot", "openapi-original.json"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -94,7 +94,7 @@ public class GoClientCodegen extends AbstractGoCodegen {
|
||||
modelPackage = packageName;
|
||||
apiPackage = packageName;
|
||||
|
||||
supportingFiles.add(new SupportingFile("swagger.mustache", "api", "swagger.yaml"));
|
||||
supportingFiles.add(new SupportingFile("swagger.mustache", "api", "openapi.yaml"));
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
|
||||
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
|
||||
|
||||
@@ -98,7 +98,7 @@ public class GoServerCodegen extends AbstractGoCodegen {
|
||||
* entire object tree available. If the input file has a suffix of `.mustache
|
||||
* it will be processed by the template engine. Otherwise, it will be copied
|
||||
*/
|
||||
supportingFiles.add(new SupportingFile("swagger.mustache", "api", "swagger.yaml"));
|
||||
supportingFiles.add(new SupportingFile("swagger.mustache", "api", "openapi.yaml"));
|
||||
supportingFiles.add(new SupportingFile("main.mustache", "", "main.go"));
|
||||
supportingFiles.add(new SupportingFile("routers.mustache", apiPath, "routers.go"));
|
||||
supportingFiles.add(new SupportingFile("logger.mustache", apiPath, "logger.go"));
|
||||
|
||||
@@ -485,7 +485,7 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
|
||||
|
||||
// root
|
||||
supportingFiles.add(new SupportingFile("haskell-http-client.cabal.mustache", "", getStringProp(PROP_CABAL_PACKAGE) + ".cabal"));
|
||||
supportingFiles.add(new SupportingFile("swagger.mustache", "", "swagger.yaml"));
|
||||
supportingFiles.add(new SupportingFile("openapi.mustache", "", "openapi.yaml"));
|
||||
|
||||
// lib
|
||||
supportingFiles.add(new SupportingFile("TopLevel.mustache", topLevelPath, lastPath + ".hs"));
|
||||
|
||||
@@ -287,19 +287,19 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf
|
||||
*/
|
||||
@Override
|
||||
public String getSchemaType(Schema p) {
|
||||
String swaggerType = super.getSchemaType(p);
|
||||
LOGGER.debug("debugging swager type: " + p.getType() + ", " + p.getFormat() + " => " + swaggerType);
|
||||
String schemaType = super.getSchemaType(p);
|
||||
LOGGER.debug("debugging swager type: " + p.getType() + ", " + p.getFormat() + " => " + schemaType);
|
||||
String type = null;
|
||||
if (typeMapping.containsKey(swaggerType)) {
|
||||
type = typeMapping.get(swaggerType);
|
||||
if (typeMapping.containsKey(schemaType)) {
|
||||
type = typeMapping.get(schemaType);
|
||||
return type;
|
||||
//if (languageSpecificPrimitives.contains(type))
|
||||
// return toModelName(type);
|
||||
} else if(typeMapping.containsValue(swaggerType)) {
|
||||
} else if(typeMapping.containsValue(schemaType)) {
|
||||
// TODO what's this case for?
|
||||
type = swaggerType + "_";
|
||||
type = schemaType + "_";
|
||||
} else {
|
||||
type = swaggerType;
|
||||
type = schemaType;
|
||||
}
|
||||
// it's a model
|
||||
return toModelName(type);
|
||||
|
||||
@@ -215,7 +215,7 @@ public class KotlinServerCodegen extends AbstractKotlinCodegen {
|
||||
if (objs.containsKey("lambda")) {
|
||||
LOGGER.warn("An property named 'lambda' already exists. Mustache lambdas renamed from 'lambda' to '_lambda'. " +
|
||||
"You'll likely need to use a custom template, " +
|
||||
"see https://github.com/swagger-api/swagger-codegen#modifying-the-client-library-format. ");
|
||||
"see https://github.com/swagger-api/swagger-codegen#modifying-the-client-library-format. "); // TODO: update the URL
|
||||
objs.put("_lambda", lambdas);
|
||||
} else {
|
||||
objs.put("lambda", lambdas);
|
||||
|
||||
@@ -312,9 +312,9 @@ public class NodeJSServerCodegen extends DefaultCodegen implements CodegenConfig
|
||||
// "controllers",
|
||||
// "controller.js")
|
||||
// );
|
||||
supportingFiles.add(new SupportingFile("swagger.mustache",
|
||||
supportingFiles.add(new SupportingFile("openapi.mustache",
|
||||
"api",
|
||||
"swagger.yaml")
|
||||
"openapi.yaml")
|
||||
);
|
||||
if (getGoogleCloudFunctions()) {
|
||||
writeOptional(outputFolder, new SupportingFile("index-gcf.mustache", "", "index.js"));
|
||||
|
||||
@@ -176,7 +176,7 @@ public class PythonFlaskConnexionServerCodegen extends DefaultCodegen implements
|
||||
supportingFiles.add(new SupportingFile("__init__model.mustache", packageName + File.separatorChar + modelPackage, "__init__.py"));
|
||||
supportingFiles.add(new SupportingFile("base_model_.mustache", packageName + File.separatorChar + modelPackage, "base_model_.py"));
|
||||
supportingFiles.add(new SupportingFile("__init__test.mustache", packageName + File.separatorChar + testPackage, "__init__.py"));
|
||||
supportingFiles.add(new SupportingFile("swagger.mustache", packageName + File.separatorChar + "swagger", "swagger.yaml"));
|
||||
supportingFiles.add(new SupportingFile("openapi.mustache", packageName + File.separatorChar + "openapi", "openapi.yaml"));
|
||||
|
||||
modelPackage = packageName + "." + modelPackage;
|
||||
controllerPackage = packageName + "." + controllerPackage;
|
||||
@@ -284,15 +284,15 @@ public class PythonFlaskConnexionServerCodegen extends DefaultCodegen implements
|
||||
|
||||
@Override
|
||||
public String getSchemaType(Schema p) {
|
||||
String swaggerType = super.getSchemaType(p);
|
||||
String schemaType = super.getSchemaType(p);
|
||||
String type = null;
|
||||
if (typeMapping.containsKey(swaggerType)) {
|
||||
type = typeMapping.get(swaggerType);
|
||||
if (typeMapping.containsKey(schemaType)) {
|
||||
type = typeMapping.get(schemaType);
|
||||
if (languageSpecificPrimitives.contains(type)) {
|
||||
return type;
|
||||
}
|
||||
} else {
|
||||
type = toModelName(swaggerType);
|
||||
type = toModelName(schemaType);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
@@ -417,7 +417,7 @@ public class PythonFlaskConnexionServerCodegen extends DefaultCodegen implements
|
||||
if (!paramName.equals(name)) {
|
||||
LOGGER.warn(name + " (parameter name) cannot be used as parameter name with flask-connexion and was sanitized as " + paramName);
|
||||
}
|
||||
// Param name is already sanitized in swagger spec processing
|
||||
// Param name is already sanitized in openapi spec processing
|
||||
return paramName;
|
||||
}
|
||||
|
||||
@@ -657,7 +657,7 @@ public class PythonFlaskConnexionServerCodegen extends DefaultCodegen implements
|
||||
}
|
||||
|
||||
/*
|
||||
* The swagger pattern spec follows the Perl convention and style of modifiers. Python
|
||||
* The openapi pattern spec follows the Perl convention and style of modifiers. Python
|
||||
* does not support this in as natural a way so it needs to convert it. See
|
||||
* https://docs.python.org/2/howto/regex.html#compilation-flags for details.
|
||||
*/
|
||||
|
||||
@@ -86,7 +86,7 @@ public class RubySinatraServerCodegen extends DefaultCodegen implements CodegenC
|
||||
supportingFiles.add(new SupportingFile("config.ru", "", "config.ru"));
|
||||
supportingFiles.add(new SupportingFile("Gemfile", "", "Gemfile"));
|
||||
supportingFiles.add(new SupportingFile("README.md", "", "README.md"));
|
||||
supportingFiles.add(new SupportingFile("swagger.mustache","","swagger.yaml"));
|
||||
supportingFiles.add(new SupportingFile("openapi.mustache","","openapi.yaml"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,7 +16,7 @@ mvn clean package jetty:run
|
||||
You can then view the swagger listing here:
|
||||
|
||||
```
|
||||
http://localhost:{{serverPort}}{{contextPath}}/swagger.json
|
||||
http://localhost:{{serverPort}}{{contextPath}}/openapi.json
|
||||
```
|
||||
|
||||
Note that if you have configured the `host` to be something other than localhost, the calls through
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
http://localhost:8080/
|
||||
|
||||
* Swagger API
|
||||
http://localhost:8080/services/swagger.json
|
||||
http://localhost:8080/services/openapi.json
|
||||
|
||||
* CXF WADL
|
||||
http://localhost:8080/services?_wadl
|
||||
|
||||
@@ -16,7 +16,7 @@ mvn clean package jetty:run
|
||||
You can then view the swagger listing here:
|
||||
|
||||
```
|
||||
http://localhost:{{serverPort}}{{contextPath}}/swagger.json
|
||||
http://localhost:{{serverPort}}{{contextPath}}/openapi.json
|
||||
```
|
||||
|
||||
Note that if you have configured the `host` to be something other than localhost, the calls through
|
||||
|
||||
@@ -12,7 +12,7 @@ You can deploy the WAR file to Jboss EAP or any other JEE server supporting Jbos
|
||||
You can then view the swagger listing here:
|
||||
|
||||
```
|
||||
http://localhost:{{serverPort}}{{contextPath}}/swagger.json
|
||||
http://localhost:{{serverPort}}{{contextPath}}/openapi.json
|
||||
```
|
||||
|
||||
Note that if you have configured the `host` to be something other than localhost, the calls through
|
||||
|
||||
@@ -10,6 +10,6 @@ public class ApiDocController extends Controller {
|
||||
}
|
||||
|
||||
public Result api() {
|
||||
return redirect("/assets/lib/swagger-ui/index.html?/url=/assets/swagger.json");
|
||||
return redirect("/assets/lib/swagger-ui/index.html?/url=/assets/openapi.json");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class MainApiVerticle extends AbstractVerticle {
|
||||
public void start(Future<Void> startFuture) throws Exception {
|
||||
Json.mapper.registerModule(new JavaTimeModule());
|
||||
FileSystem vertxFileSystem = vertx.fileSystem();
|
||||
vertxFileSystem.readFile("swagger.json", readFile -> {
|
||||
vertxFileSystem.readFile("openapi.json", readFile -> {
|
||||
if (readFile.succeeded()) {
|
||||
Swagger swagger = new SwaggerParser().parse(readFile.result().toString(Charset.forName("utf-8")));
|
||||
Router swaggerRouter = SwaggerRouter.swaggerRouter(router, swagger, vertx.eventBus(), new OperationIdServiceIdResolver());
|
||||
|
||||
@@ -17,6 +17,8 @@ org.openapitools.codegen.languages.DartClientCodegen
|
||||
org.openapitools.codegen.languages.ElixirClientCodegen
|
||||
org.openapitools.codegen.languages.ErlangClientCodegen
|
||||
org.openapitools.codegen.languages.ErlangServerCodegen
|
||||
org.openapitools.codegen.languages.GoClientCodegen
|
||||
org.openapitools.codegen.languages.GoServerCodegen
|
||||
org.openapitools.codegen.languages.KotlinClientCodegen
|
||||
org.openapitools.codegen.languages.KotlinServerCodegen
|
||||
org.openapitools.codegen.languages.HaskellHttpClientCodegen
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace {{packageName}}
|
||||
Contact = new Contact()
|
||||
{
|
||||
Name = "{{#infoName}}{{{infoName}}}{{/infoName}}{{^infoName}}Swagger Codegen Contributors{{/infoName}}",
|
||||
Url = "{{#infoUrl}}{{{infoUrl}}}{{/infoUrl}}{{^infoUrl}}https://github.com/swagger-api/swagger-codegen{{/infoUrl}}",
|
||||
Url = "{{#infoUrl}}{{{infoUrl}}}{{/infoUrl}}{{^infoUrl}}https://github.com/openapitools/openapi-generator{{/infoUrl}}",
|
||||
Email = "{{#infoEmail}}{{{infoEmail}}}{{/infoEmail}}"
|
||||
},
|
||||
TermsOfService = "{{#termsOfService}}{{{termsOfService}}}{{/termsOfService}}"
|
||||
@@ -97,10 +97,10 @@ namespace {{packageName}}
|
||||
.UseSwaggerUI(c =>
|
||||
{
|
||||
//TODO: Either use the SwaggerGen generated Swagger contract (generated from C# classes)
|
||||
c.SwaggerEndpoint("/swagger/{{#version}}{{{version}}}{{/version}}{{^version}}v1{{/version}}/swagger.json", "{{#appName}}{{{appName}}}{{/appName}}{{^appName}}{{packageName}}{{/appName}}");
|
||||
c.SwaggerEndpoint("/swagger/{{#version}}{{{version}}}{{/version}}{{^version}}v1{{/version}}/openapi.json", "{{#appName}}{{{appName}}}{{/appName}}{{^appName}}{{packageName}}{{/appName}}");
|
||||
|
||||
//TODO: Or alternatively use the original Swagger contract that's included in the static files
|
||||
// c.SwaggerEndpoint("/swagger-original.json", "{{#appName}}{{{appName}}}{{/appName}}{{^appName}}{{packageName}}{{/appName}} Original");
|
||||
// c.SwaggerEndpoint("/openapi-original.json", "{{#appName}}{{{appName}}}{{/appName}}{{^appName}}{{packageName}}{{/appName}} Original");
|
||||
});
|
||||
|
||||
if (env.IsDevelopment())
|
||||
|
||||
@@ -47,7 +47,7 @@ Define custom codegen properties in a Json file, e.g.:
|
||||
|
||||
Generate the client:
|
||||
```shell
|
||||
$ java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i http://petstore.swagger.io/v2/swagger.json -l bash -o generated/bash/petstore -c modules/swagger-codegen/src/test/resources/2_0/bash-config.json
|
||||
$ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i http://petstore.swagger.io/v2/swagger.json -l bash -o generated/bash/petstore -c modules/openapi-generator/src/test/resources/2_0/bash-config.json
|
||||
|
||||
$ chmod +x generated/bash/petstore/petstore-cli
|
||||
```
|
||||
|
||||
@@ -46,7 +46,7 @@ mvn package
|
||||
In your generator project. A single jar file will be produced in `target`. You can now use that with codegen:
|
||||
|
||||
```
|
||||
java -cp /path/to/swagger-codegen-cli.jar:/path/to/your.jar org.openapitools.codegen.Codegen -l {{name}} -i /path/to/swagger.yaml -o ./test
|
||||
java -cp /path/to/swagger-codegen-cli.jar:/path/to/your.jar org.openapitools.codegen.Codegen -l {{name}} -i /path/to/openapi.yaml -o ./test
|
||||
```
|
||||
|
||||
Now your templates are available to the client generator and you can write output values
|
||||
|
||||
@@ -69,6 +69,6 @@ prepare_validator() ->
|
||||
|
||||
get_swagger_path() ->
|
||||
{ok, AppName} = application:get_application(?MODULE),
|
||||
filename:join({{packageName}}_utils:priv_dir(AppName), "swagger.json").
|
||||
filename:join({{packageName}}_utils:priv_dir(AppName), "openapi.json").
|
||||
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ http://localhost:{{serverPort}}{{contextPath}}/ui/
|
||||
Your Swagger definition lives here:
|
||||
|
||||
```
|
||||
http://localhost:{{serverPort}}{{contextPath}}/swagger.json
|
||||
http://localhost:{{serverPort}}{{contextPath}}/openapi.json
|
||||
```
|
||||
|
||||
To launch the integration tests, use tox:
|
||||
|
||||
@@ -10,7 +10,7 @@ class BaseTestCase(TestCase):
|
||||
|
||||
def create_app(self):
|
||||
logging.getLogger('connexion.operation').setLevel('ERROR')
|
||||
app = connexion.App(__name__, specification_dir='../swagger/')
|
||||
app = connexion.App(__name__, specification_dir='../openapi/')
|
||||
app.app.json_encoder = JSONEncoder
|
||||
app.add_api('swagger.yaml')
|
||||
app.add_api('openapi.yaml')
|
||||
return app.app
|
||||
|
||||
@@ -11,9 +11,9 @@ from {{packageName}} import encoder
|
||||
|
||||
|
||||
def main():
|
||||
app = connexion.App(__name__, specification_dir='./swagger/')
|
||||
app = connexion.App(__name__, specification_dir='./openapi/')
|
||||
app.app.json_encoder = encoder.JSONEncoder
|
||||
app.add_api('swagger.yaml', arguments={'title': '{{appName}}'})
|
||||
app.add_api('openapi.yaml', arguments={'title': '{{appName}}'})
|
||||
app.run(port={{serverPort}})
|
||||
|
||||
|
||||
|
||||
@@ -21,10 +21,10 @@ setup(
|
||||
description="{{appName}}",
|
||||
author_email="{{infoEmail}}",
|
||||
url="{{packageUrl}}",
|
||||
keywords=["Swagger", "{{appName}}"],
|
||||
keywords=["OpenAPI", "{{appName}}"],
|
||||
install_requires=REQUIRES,
|
||||
packages=find_packages(),
|
||||
package_data={'': ['swagger/swagger.yaml']},
|
||||
package_data={'': ['openapi/openapi.yaml']},
|
||||
include_package_data=True,
|
||||
entry_points={
|
||||
'console_scripts': ['{{packageName}}={{packageName}}.__main__:main']},
|
||||
|
||||
@@ -29,7 +29,7 @@ cabal-version: >= 1.10
|
||||
|
||||
extra-source-files:
|
||||
README.md
|
||||
swagger.yaml
|
||||
openapi.yaml
|
||||
|
||||
library
|
||||
hs-source-dirs:
|
||||
|
||||
@@ -50,7 +50,7 @@ will be enabled.
|
||||
inside the swagger codegen maven plugin under the configuration section
|
||||
|
||||
<configuration>
|
||||
<inputSpec>product-swagger.yaml</inputSpec>
|
||||
<inputSpec>product-openapi.yaml</inputSpec>
|
||||
<language>pkmst</language>
|
||||
<output>${project.build.directory}/generated-sources</output>
|
||||
<configOptions>
|
||||
|
||||
@@ -11,7 +11,7 @@ var options = {
|
||||
};
|
||||
|
||||
// The Swagger document (require it, build it programmatically, fetch it from a URL, ...)
|
||||
var spec = fs.readFileSync('./api/swagger.yaml', 'utf8');
|
||||
var spec = fs.readFileSync('./api/openapi.yaml', 'utf8');
|
||||
var swaggerDoc = jsyaml.safeLoad(spec);
|
||||
|
||||
function toPromise(f, req, res) {
|
||||
|
||||
@@ -11,13 +11,13 @@ var serverPort = {{serverPort}};
|
||||
|
||||
// swaggerRouter configuration
|
||||
var options = {
|
||||
swaggerUi: path.join(__dirname, '/swagger.json'),
|
||||
swaggerUi: path.join(__dirname, '/openapi.json'),
|
||||
controllers: path.join(__dirname, './controllers'),
|
||||
useStubs: process.env.NODE_ENV === 'development' // Conditionally turn on stubs (mock mode)
|
||||
};
|
||||
|
||||
// The Swagger document (require it, build it programmatically, fetch it from a URL, ...)
|
||||
var spec = fs.readFileSync(path.join(__dirname,'api/swagger.yaml'), 'utf8');
|
||||
var spec = fs.readFileSync(path.join(__dirname,'api/openapi.yaml'), 'utf8');
|
||||
var swaggerDoc = jsyaml.safeLoad(spec);
|
||||
|
||||
// Initialize the Swagger middleware
|
||||
|
||||
Reference in New Issue
Block a user