-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Python 3.7] Maven generation api 3.0.9 #9546
Comments
I suggest that you post your API spec so the developers can try to reproduce the problem. |
Sorry, but i can't. My company refuse to make the code public. |
I have the same issue with 3.0.9 and 3.0.10 - 3.0.8 works. The issue seems to be in https://github.com/swagger-api/swagger-codegen-generators |
I've got the more or less same issue using the 3.0.10 swagger-codegen-cli docker image. It doesn't depend if i choose spring or python as target language. The OpenAPI3 spec i'm using is a converted OData CSDL from our internal CMDB. Rather largish - json file is 8mb. There are many linked resources (Computers have Adapters, Adapters have Computers, ...) Unfortunatly I can't provide the OpenAPI3 spec and I failed to create a reproducer with Petstore. :-( Generate completes successfully with swagger-codgen-cli 3.0.8 - but Python code is invalid (which i think is fixed with 3.0.10).
|
hello guys, working on this right now. |
@HugoMario Could you provide a jar that prints out the schema and the property that the I was able to build swagger-codgen with run-in-docker.sh but I have no clue how to integrate such a change from dependent repo. |
@HugoMario I came to the conclusion, that the problem is the recursive function: my spec got 1527 schemas with 14820 properties. And everything is heavily linked. |
@HugoMario managed to convert the CSDL with OpenAPI.NET.OData to OpenAPI3. swagger-codegen then exited successfully. :-) but the client is still not useable. But this is another issue. |
hi @vinzent, thanks for updates, checking issue i found a way to reproduce it too, in a scenario when we find circular references i.e: Category:
type: object
properties:
id:
type: integer
format: int64
pet:
$ref: '#/components/schemas/Pet'
Pet:
type: object
properties:
id:
type: integer
format: int64
category:
$ref: '#/components/schemas/Category' the issue is triggered, i guess it's the same if there are circular reference among three or more schemas. |
Similar issue that only occurs on version 3.0.9 and 3.0.10 but is fine on 3.0.8 (not using Python but Java but that shouldn't make a difference?): Exception in thread "main" java.lang.StackOverflowError
at java.lang.String.lastIndexOf(String.java:1827)
at java.lang.String.lastIndexOf(String.java:1807)
at io.swagger.codegen.v3.generators.util.OpenAPIUtil.getSimpleRef(OpenAPIUtil.java:33)
at io.swagger.codegen.v3.generators.examples.ExampleGenerator.resolveSchemaToExample(ExampleGenerator.java:231)
at io.swagger.codegen.v3.generators.examples.ExampleGenerator.resolveSchemaToExample(ExampleGenerator.java:247)
at io.swagger.codegen.v3.generators.examples.ExampleGenerator.resolveSchemaToExample(ExampleGenerator.java:240)
at io.swagger.codegen.v3.generators.examples.ExampleGenerator.resolveSchemaToExample(ExampleGenerator.java:247)
at io.swagger.codegen.v3.generators.examples.ExampleGenerator.resolveSchemaToExample(ExampleGenerator.java:240)
at io.swagger.codegen.v3.generators.examples.ExampleGenerator.resolveSchemaToExample(ExampleGenerator.java:247)
at io.swagger.codegen.v3.generators.examples.ExampleGenerator.resolveSchemaToExample(ExampleGenerator.java:240)
at io.swagger.codegen.v3.generators.examples.ExampleGenerator.resolveSchemaToExample(ExampleGenerator.java:247) |
I'm seeing the same thing (recursive
I've compiled and installed all of the swagger-codegen projects locally, and I'm attempting to generate my schema in offline mode to ensure that I use the locally installed variants:
I have a couple of profiles for generating code in different languages, hence the |
Ah...never mind. I see that this error is from this ExampleGenerator in the |
Here's a sample spec that causes this failure. It models a simple hierarchy of nodes of a single type. openapi: 3.0.0
info:
title: "Recursion Demo, Issue #9546"
description: This schema includes structures that cause recursive failure in ExampleGenerator.
version: "0.1.0"
paths:
/recursion:
get:
summary: fail
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/OptionHierarchyNode'
components:
schemas:
OptionHierarchyNode:
type: object
required:
- key
properties:
key:
type: string
description: The key of an object (in a separate dictionary) describing the attributes of
the node.
defaultValue:
type: string
description: The key of the node in the options list that is selected by default.
displayOrder:
type: number
format: integer
description: Optional; the intended position of the node relative to sibling nodes. If
undefined, the UI should display them in the order in which they are listed. Ordered
nodes take precedence over unordered nodes.
options:
type: array
description: Selectable values for the current node.
items:
$ref: '#/components/schemas/OptionHierarchyNode' |
I added the following warning before this invocation (in the external module): logger.warn("Recursively resolving schema for " + propName.toString()); and the schema above produced the following output, with the warnings repeated recursively, as expected, until the stack overflow:
|
@HugoMario - I've created a PR to address this in the swagger-codegen-generators repo. |
hi @scottydawg, yes, i saw your PR thanks a lot !!, i'll add feedback there |
hello guys PR's swagger-codegen-generators#431 and swagger-codegen-generators#432 have been added in order to fix this issue. Can you please check if it works for you now? you can use this file with command:
|
I successfully ran this against my schema without the stack overflow. 👍 |
Description
Hello,
I generate my APIs in python with maven. I use the version 3.0.8 of swagger-codegen-maven-plugin. But python is an experimental moud and i have some error about Thread can't be created (maybe their are not closed) and MemoryError. So i want to use the version 3.0.9, with hope to not find the same errors.
But impossible to build my APIs, see below:
POM.XML
COMMAND
ERROR OUTPUT
Can you help me please ? :)
The text was updated successfully, but these errors were encountered: