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

components.parameters.region.schema.enum does not contain 'en' which is the default value in openapi3 spec #197

Closed
WORMSS opened this issue Sep 4, 2021 · 9 comments · Fixed by #198
Labels

Comments

@WORMSS
Copy link

WORMSS commented Sep 4, 2021

components.parameters.region.schema.enum does not contain 'en' which is the default value

located in the openapi3 spec

/dist/google-maps-platform-openapi3.json

Seems I can't link directly to the file for ease of use, because Github thinks the file is too big.

Should be around line 28303-28558

@jpoehnelt
Copy link
Contributor

Thanks for catching this! I'll get a fix out right away. Do you mind sharing how you are using the Open API spec or the various outputs that lead you to this bug? Thanks again!

@WORMSS
Copy link
Author

WORMSS commented Sep 5, 2021

Ran it against https://github.com/ferdikoomen/openapi-typescript-codegen
it tried to do region = 'en' but 'en' was an invalid input

@jpoehnelt
Copy link
Contributor

Got it. Any other issues with codegen? I'm looking to eventually generate and publish some libraries from this.

@WORMSS
Copy link
Author

WORMSS commented Sep 5, 2021

But.... I actually had to fix a bug in the repo, since their version couldn't handle the ~1 for path argument in references... so see ferdikoomen/openapi-typescript-codegen#824 for my hack/fix

@jpoehnelt
Copy link
Contributor

I could add a dereferenced (resolve all $ref) spec if that seems to be an issue with codegens.

@github-actions
Copy link

github-actions bot commented Sep 5, 2021

🎉 This issue has been resolved in version 1.16.20 🎉

The release is available on:

Your semantic-release bot 📦🚀

@WORMSS
Copy link
Author

WORMSS commented Sep 5, 2021

Could do. I personally think the codegens should be able to deal with the spec correctly.. I've found others which can..

The only issue is that the naming of the endpoints were really bad.. Like.. REALLY bad.. after it got spit out of the codegen.

End endpoints ended up being like

getPlacesApiService()
getPlacesApiService1()
getPlacesApiService2()
getPlacesApiService3()
getPlacesApiService4()

instead of something useful like

getPlacesTextSearch()
getPlacesDetails()

etc etc

I am unsure if that is an issue with the openapi-typescript-codegen or the spec file though. I would have to check that particular issue with other tools and see what they spit out..
Since you correctly tagged similar apis such as places/roads/streetview.. I would presume you are doing things right.

I know it handles our own api correctly, but I have not done a side by side to know 'how' these codegens decide the names of the functions

@jpoehnelt
Copy link
Contributor

Seems I could improve that with operationId although the fallback in the could also be improved. https://github.com/ferdikoomen/openapi-typescript-codegen/blob/830b317d0a0f6aaa97dba43818ce6d1ccc109be2/src/openApi/v3/parser/getOperation.ts#L22-L23

@WORMSS
Copy link
Author

WORMSS commented Sep 5, 2021

It would seem you hit it perfectly..
our API has "operationId": "Card_CardAccessAdvisorByRole", and the function does seem to indicate this is what it would output if you remove non alphanumerics and run a run camelcase on it would result in cardCardAccessAdvisorByUser and that is exactly what we get.
the cardCard in our codebase is a little undesirable, but nothing to cry too much about...

Good spot with getOperation

@jpoehnelt jpoehnelt removed their assignment Jun 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants