Hello,
When running the maven plugin on a json file (de-refed, all local definitions),
It can't find components in the json OpenAPI.
But it is there.
Using that JSON file we are able to generate a REST service using the generic OpenAPI generation tool.
Update:
Issue is with the ref of stuff_alias_identifier to base_identifier inside the components.
When embedded directly (removing base_identifier and writing its contents inside the other *_identifiers, it is able to generate the service.
we get this error:
Error from PROJECT_GENERATION_FAILED.txt :
Server Stack Trace:
java.lang.IllegalArgumentException: Path not present: components
at org.jsonschema2pojo.FragmentResolver.resolve(FragmentResolver.java:55)
at org.jsonschema2pojo.FragmentResolver.resolve(FragmentResolver.java:31)
at org.jsonschema2pojo.SchemaStore.create(SchemaStore.java:138)
at io.apicurio.hub.api.codegen.OpenApi2JaxRs$2.create(OpenApi2JaxRs.java:885)
at org.jsonschema2pojo.rules.SchemaRule.apply(SchemaRule.java:69)
at org.jsonschema2pojo.rules.SchemaRule.apply(SchemaRule.java:38)
at org.jsonschema2pojo.rules.PropertyRule.apply(PropertyRule.java:85)
at org.jsonschema2pojo.rules.PropertyRule.apply(PropertyRule.java:42)
at org.jsonschema2pojo.rules.PropertiesRule.apply(PropertiesRule.java:70)
at org.jsonschema2pojo.rules.PropertiesRule.apply(PropertiesRule.java:38)
at org.jsonschema2pojo.rules.ObjectRule.apply(ObjectRule.java:120)
at org.jsonschema2pojo.rules.ObjectRule.apply(ObjectRule.java:65)
at org.jsonschema2pojo.rules.TypeRule.apply(TypeRule.java:86)
at org.jsonschema2pojo.rules.TypeRule.apply(TypeRule.java:41)
at org.jsonschema2pojo.rules.SchemaRule.apply(SchemaRule.java:83)
at org.jsonschema2pojo.rules.SchemaRule.apply(SchemaRule.java:38)
at org.jsonschema2pojo.SchemaMapper.generate(SchemaMapper.java:135)
at io.apicurio.hub.api.codegen.OpenApi2JaxRs.generateJavaBean(OpenApi2JaxRs.java:890)
at io.apicurio.hub.api.codegen.OpenApi2JaxRs.generateAll(OpenApi2JaxRs.java:290)
at io.apicurio.hub.api.codegen.OpenApi2JaxRs.generate(OpenApi2JaxRs.java:216)
at io.apicurio.codegen.maven.GenerateCodeMojo.execute(GenerateCodeMojo.java:77)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:126)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:328)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000(MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run(MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute(DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:261)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:173)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:101)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:906)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:283)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:206)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:283)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:226)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:407)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:348)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Reproducing sample:
{
"openapi" : "3.0.3",
"info" : {
"title" : "Stuff alias actions in the stuff service",
"version" : "1.0.0"
},
"servers" : [ {
"url" : "/"
} ],
"tags" : [ {
"name" : "StuffAlias"
} ],
"paths" : {
"/api/rest/v1/stuff/alias/" : {
"post" : {
"tags" : [ "StuffAlias" ],
"summary" : "Create a stuff alias",
"operationId" : "stuffAliasCreate",
"requestBody" : {
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/CreateStuffAliasRequestBody"
}
}
}
},
"responses" : {
"200" : {
"description" : "Successfully created",
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/CreateStuffAliasResponseBody"
}
}
}
}
}
}
}
},
"components" : {
"schemas" : {
"CreateStuffAliasRequestBody" : {
"required" : [ "stuffId" ],
"type" : "object",
"properties" : {
"stuffId" : {
"$ref" : "#/components/schemas/stuff_identifier"
}
}
},
"CreateStuffAliasResponseBody" : {
"required" : [ "stuffAliasId" ],
"type" : "object",
"properties" : {
"stuffAliasId" : {
"$ref" : "#/components/schemas/stuff_alias_identifier"
}
}
},
"stuff_alias_identifier" : {
"$ref" : "#/components/schemas/base_identifier"
},
"base_identifier" : {
"type" : "string",
"format" : "uuid"
},
"stuff_identifier" : {
"$ref" : "#/components/schemas/base_identifier"
}
}
}
}
Hello,
When running the maven plugin on a json file (de-refed, all local definitions),
It can't find
componentsin the json OpenAPI.But it is there.
Using that JSON file we are able to generate a REST service using the generic OpenAPI generation tool.
Update:
Issue is with the ref of
stuff_alias_identifiertobase_identifierinside thecomponents.When embedded directly (removing base_identifier and writing its contents inside the other *_identifiers, it is able to generate the service.
we get this error:
Error from
PROJECT_GENERATION_FAILED.txt:Reproducing sample:
{ "openapi" : "3.0.3", "info" : { "title" : "Stuff alias actions in the stuff service", "version" : "1.0.0" }, "servers" : [ { "url" : "/" } ], "tags" : [ { "name" : "StuffAlias" } ], "paths" : { "/api/rest/v1/stuff/alias/" : { "post" : { "tags" : [ "StuffAlias" ], "summary" : "Create a stuff alias", "operationId" : "stuffAliasCreate", "requestBody" : { "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/CreateStuffAliasRequestBody" } } } }, "responses" : { "200" : { "description" : "Successfully created", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/CreateStuffAliasResponseBody" } } } } } } } }, "components" : { "schemas" : { "CreateStuffAliasRequestBody" : { "required" : [ "stuffId" ], "type" : "object", "properties" : { "stuffId" : { "$ref" : "#/components/schemas/stuff_identifier" } } }, "CreateStuffAliasResponseBody" : { "required" : [ "stuffAliasId" ], "type" : "object", "properties" : { "stuffAliasId" : { "$ref" : "#/components/schemas/stuff_alias_identifier" } } }, "stuff_alias_identifier" : { "$ref" : "#/components/schemas/base_identifier" }, "base_identifier" : { "type" : "string", "format" : "uuid" }, "stuff_identifier" : { "$ref" : "#/components/schemas/base_identifier" } } } }