Skip to content

Handle hyphens in function names #12

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

Merged
merged 6 commits into from
Jun 29, 2022

Conversation

zmk-punchbowl
Copy link
Contributor

In our serverless.yml, we use hyphens (-) in our function names (for example note-get, and note-create) and this is a legal convention in Serverless. However, we could not use this plugin to document our API because of this (since - is not legally allowed in a Typescript namespace).

This PR adjusts the way function names are converted to namespace names using camelCase from lodash. For example, note-get becomes noteGet and note_create-multiple would become noteCreateMultiple.

I also added a basic test for this (mostly relying on an existing test). Hopefully this helps. Thanks for creating a useful plugin.

Note that in our own usage, I could not get the plugin working with @conqa/serverless-openapi-documentation and had to swap it out for @martinsson/serverless-openapi-documentation, but since that seems to be unrelated to this issue, I left that in a separate branch for now.

@zmk-punchbowl zmk-punchbowl marked this pull request as ready for review January 10, 2022 20:30
@zmk-punchbowl zmk-punchbowl changed the title Pascal case for function names Handle hyphens in function names Jan 10, 2022
@omry-hay omry-hay requested a review from a team January 14, 2022 19:59
@roni-frantchi
Copy link
Contributor

Hey @zmk-punchbowl thanks so much for this contribution! ❤️
Both implementation and test added looks great to me.
Would you mind also adding a note on our README ?

I could not get the plugin working with @conqa/serverless-openapi-documentation and had to swap it out for @martinsson/serverless-openapi-documentation

If you could open a separate issue with some more details as to the error/versions used/anything we can use to recreate we'd be happy to look at it.

Thanks!

@zmk-punchbowl
Copy link
Contributor Author

Hey @zmk-punchbowl thanks so much for this contribution! ❤️ Both implementation and test added looks great to me. Would you mind also adding a note on our README ?

I could not get the plugin working with @conqa/serverless-openapi-documentation and had to swap it out for @martinsson/serverless-openapi-documentation

If you could open a separate issue with some more details as to the error/versions used/anything we can use to recreate we'd be happy to look at it.

Thanks!

Thanks @roni-frantchi. I've made an update to the README that is hopefully acceptable.

I've moved onto another development priority at the moment, so unfortunately, I'm not sure when I'll be able to repro & document the issue I had with the plugin dependency. If it's working well for you guys, then it may just be in my environment.

@roni-frantchi roni-frantchi self-assigned this Jun 29, 2022
Copy link
Contributor

@roni-frantchi roni-frantchi left a comment

Choose a reason for hiding this comment

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

@zmk-punchbowl sorry for taking so long.

@roni-frantchi roni-frantchi merged commit de08fc4 into env0:main Jun 29, 2022
@zmk-punchbowl
Copy link
Contributor Author

@zmk-punchbowl sorry for taking so long.

No problem! Thanks for maintaining this useful package.

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

Successfully merging this pull request may close these issues.

2 participants