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

Sanitizes model names so they're valid class/interface names #4127

Merged
merged 1 commit into from
Oct 15, 2019

Conversation

snebjorn
Copy link
Contributor

@snebjorn snebjorn commented Oct 11, 2019

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh, ./bin/openapi3/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\. If contributing template-only or documentation-only changes which will change sample output, be sure to build the project first.
  • Filed the PR against the correct branch: master, 4.1.x, 5.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

fixes #4097
though the issue was about Angular the issue is a core issue

int count = 0;
boolean done = false;
key = key.replaceAll("/", "_"); // e.g. /me/videos => _me_videos
key = key.replaceAll("[^a-z_\\.A-Z0-9 ]", ""); // FIXME: a parameter
Copy link
Contributor Author

@snebjorn snebjorn Oct 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't make sense of why \ and . was allowed, so I removed them.
If anyone got some input on it I'm listening 👂

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea either. git blame doesn't reveal useful information. It may be a bug that's present a while ago.

Copy link
Member

@macjohnny macjohnny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@macjohnny
Copy link
Member

cc @OpenAPITools/generator-core-team

@snebjorn
Copy link
Contributor Author

Hmm think I messed up. Isn't this the code that generate backend stuff and not frontend stuff?
It's probably still valid, but just missing the frontend stuff :/

@macjohnny
Copy link
Member

the code is responsible for creating the abstract model used by e.g. the frontend generators, so I think this should also apply for the frontend clients.

@snebjorn
Copy link
Contributor Author

snebjorn commented Oct 14, 2019

Your CircleCI tests were canceled

Can someone trigger a rebuild

@macjohnny
Copy link
Member

Your CircleCI tests were canceled

Can someone trigger a rebuild

I re-started the CircleCI build

@wing328
Copy link
Member

wing328 commented Oct 15, 2019

CircleCI issue has been addressed.

@wing328 wing328 merged commit 5de0f01 into OpenAPITools:master Oct 15, 2019
@wing328 wing328 changed the title sanitizes model names so they're valid class/interface names fixes #4097 Sanitizes model names so they're valid class/interface names fixes #4097 Oct 15, 2019
@wing328 wing328 added this to the 4.2.0 milestone Oct 15, 2019
@wing328 wing328 changed the title Sanitizes model names so they're valid class/interface names fixes #4097 Sanitizes model names so they're valid class/interface names Oct 30, 2019
@wing328
Copy link
Member

wing328 commented Oct 31, 2019

@snebjorn thanks for the PR, which has been included in v4.2.0 release: https://twitter.com/oas_generator/status/1189824932345069569

@snebjorn snebjorn deleted the bugfix/4097-spaces-in-title branch November 1, 2019 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] spaces in schema.title causes spaces in interface
3 participants