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

Storefront Swagger JSON is invalid #558

Open
tkf-ordeno opened this issue Sep 20, 2024 · 2 comments
Open

Storefront Swagger JSON is invalid #558

tkf-ordeno opened this issue Sep 20, 2024 · 2 comments
Labels
bug Something isn't working release/15.0.0

Comments

@tkf-ordeno
Copy link

Describe the bug
I was generating TypeScript models with the Storefront Swagger JSON and got this error:

ERROR ✘ Every operation must have a unique operationId.

And looking at the Swagger docs this is also documented at https://swagger.io/docs/specification/paths-and-operations/

operationId is an optional unique string used to identify an operation. If provided, these IDs must be unique among all operations described in your API.

When inspecting the Storefront swagger.json it seems the operationIds that has duplicates is

  • post
  • patch
  • delete
  • get
  • getV2

Umbraco Commerce version:
Umbraco.Commerce 14.0

@tkf-ordeno tkf-ordeno added the bug Something isn't working label Sep 20, 2024
@tkf-ordeno
Copy link
Author

On a related note - I manually edited the operationIds in the JSON, but when I generated the TypeScript models again with https://github.com/openapi-ts/openapi-typescript/tree/main/packages/openapi-typescript

Then the following Storefront Swagger JSON snippet:
image

For the endpoint /umbraco/commerce/storefront/api/v1/store/{idOrAlias}

Will generate the following TypeScript:
image

Which will make values like Billing-Country impossible to assign a value in TypeScript.
Maybe avoid oneOf for simple string values?

@mattbrailsford
Copy link
Contributor

Thanks for reporting this. We have learned a lot since creating the Storefront API where this wasn't originally taken into account. Given this would be considered a breaking change however, we will only be able to address this in v15. I believe this should already be resolved in the v15 codebase, but I'll leave this open until we make a release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working release/15.0.0
Projects
None yet
Development

No branches or pull requests

2 participants