Skip to content

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

@LinusBolls

Description

@LinusBolls

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions