Skip to content
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

Generates bad enum constant if enum value is all punctuation #376

Open
mgabeler-lee-6rs opened this issue Jan 29, 2025 · 0 comments
Open

Comments

@mgabeler-lee-6rs
Copy link

Given a field like:

				"logic": {
					"type": "string",
					"enum": ["<", "<=", "==", "!=", ">", ">="]
				},

The generated code looks something like:

const Logic Logic = "=="
const Logic Logic = "!="
const Logic Logic = ">"
const Logic Logic = "<"
const Logic Logic = ">="
const Logic Logic = "<="

which is obviously invalid.

It looks like Caser.Identifierize needs handling for the case when the initially computed identifier is the same as the type name, and schemaGenerator.makeEnumType might also need some handling if multiple enum values map to the same constant name, to append _1,_2 etc or some other disambiguator.

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