Skip to content

array return types get assigned names that contain special characters, breaking tooling #72

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

Open
LinusBolls opened this issue May 24, 2025 · 0 comments

Comments

@LinusBolls
Copy link

this code:

// Foo[] is BAD and breaks our action!
@GetMapping
public ResponseEntity<ResponseEnvelope<Foo[]>> getFoos() {
    ...
}

gets parsed into this:

"ResponseEnvelopeFoo[]": {
    "type": "object",
    "properties": {
        "status": { "type": "string", "enum": ["OK", "ERROR"] },
        "httpCode": { "type": "integer", "format": "int32" },
        "data": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/Foo" }
        },
        "error": { "$ref": "#/components/schemas/ErrorDetails" }
    }
}

which is of course valid json and allowed by the openapi spec, but it did break my tooling and it took me a good hour to figure out what happened.
if you don't consider this a bug and don't want to break backwards compatibility for this i understand, maybe add a configuration option <entityNamesMayContainSpecialCharacters>false</entityNamesMayContainSpecialCharacters> and add a console warning if an entity like this is generated? cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant