Skip to content

Generates identical identifiers for enum values that are non-alphabetical #15

Description

@antifuchs

I'm trying to generate an oapi 3.1 client for the mealie OpenAPI spec (will attach the .json spec) and the generator emits the following constants for an enum (specified in the schema as "RelationalOperator":{"type":"string","enum":["=","<>",">","<",">=","<="],"title":"RelationalOperator"}):

type RelationalOperator string

const (
	RelationalOperatorUnknown RelationalOperator = "="
	RelationalOperatorUnknown RelationalOperator = "<>"
	RelationalOperatorUnknown RelationalOperator = ">"
	RelationalOperatorUnknown RelationalOperator = "<"
	RelationalOperatorUnknown RelationalOperator = ">="
	RelationalOperatorUnknown RelationalOperator = "<="
)

I guess the generator should use a counter for the "unknown" variables (or use the character names, but that'd become really verbose very quickly), otherwise the generated code isn't syntactically correct.

For now I'll patch this out of my spec document, but would be neat if this just worked fully out of the box - just like the rest of the generator, which seems pretty bulletproof!

mealy-openapi.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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