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

Camel case does not adjust path parameters #138

Closed
jayvdb opened this issue Jul 31, 2020 · 4 comments
Closed

Camel case does not adjust path parameters #138

jayvdb opened this issue Jul 31, 2020 · 4 comments

Comments

@jayvdb
Copy link
Contributor

jayvdb commented Jul 31, 2020

While path param names are internal to the spec doc, effectively only placeholders, having no bearing on actual use of the API, it is odd to use djangorestframework-camel-case and have snake case used for these path parameters while the rest of the spec uses camel case.

  /oscarapi/baskets/{basket_pk}/lines/{id}/:
    get:
      operationId: oscarapi_baskets_lines_retrieve
      description: |-
        Only the field `quantity` can be changed in this view.
        All other fields are readonly.
      parameters:
      - in: path
        name: basket_pk
        schema:
          type: integer
        required: true
      - in: path
        name: id
        schema:
          type: integer
        description: A unique integer value identifying this Cart line.
        required: true
@tfranzel
Copy link
Owner

tfranzel commented Sep 7, 2020

@jayvdb i already prepared something. i would add one settings for camelizing both operationId and parameter names. that should make it consistent with djangorestframework-camel-case.

what do you think is better, camelize with capital first letter or not? basketPk or BasketPk , OscarapiBasketsLinesRetrieve or oscarapiBasketsLinesRetrieve. i think the serializer fields have no capital letter, so probably the latter, right?

@jayvdb
Copy link
Contributor Author

jayvdb commented Sep 7, 2020

Presumably this is part of the integration with djangorestframework-camel-case, so please be consistent with djangorestframework-camel-case , also called Dromedary case.

That would be basketPk and oscarapiBasketsLinesRetrieve.

The other one is Pascal case, and there are vanishing few uses of it.

tfranzel added a commit that referenced this issue Sep 7, 2020
@tfranzel
Copy link
Owner

tfranzel commented Sep 7, 2020

@jayvdb please have a look and close if the new config CAMELIZE_NAMES works for you.

@jayvdb
Copy link
Contributor Author

jayvdb commented Sep 8, 2020

The tests that you wrote look good. Unfortunately I have diverged due to discarded PRs, so not worth time to set up testing of master.

@jayvdb jayvdb closed this as completed Sep 8, 2020
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

2 participants