[Bug] Duplicate examples if summary match in request/response
Describe the bug
If example names match in the request and response (a convention leveraged by Microcks to help match response examples to request examples) then fern generate produces errors as it seems to want all examples to have unique names.
[api]: Found 2 errors and 0 warnings. Run fern check --warnings to print out the warnings.
[api]: payments.yml -> service -> endpoints -> create-booking-payment
Duplicate example name: Card Payment
[api]: payments.yml -> service -> endpoints -> create-booking-payment
Duplicate example name: Bank Account Payment
Example OpenAPI.
post:
requestBody:
required: true
content:
application/json:
schema:
...
examples:
Card:
summary: Card Payment
value:
...
Bank:
summary: Bank Account Payment
value:
...
responses:
'200':
description: Payment successful
content:
application/json:
schema:
...
examples:
Card:
summary: Card Payment
value:
...
Bank:
summary: Bank Account Payment
value:
...
To reproduce
Steps to reproduce the behavior:
- Using the Bump.sh Train Travel API openapi.yaml https://github.com/bump-sh-examples/train-travel-api
- And using generators:
generators:
- name: fernapi/fern-typescript-node-sdk
version: 0.9.5
output:
location: local-file-system
path: ../sdks/typescript
- name: fernapi/fern-typescript-express
version: 0.17.3
output:
location: local-file-system
path: ../server/express
- Run the command
fern generate - See error
Expected behavior
I expect the train travel api to generate openapi without errors.
CLI Version
0.39.4
Update, my mistake, it's not the names (the variable name in the YAML) but the summary string.
If I change the examples summary string in the response then all summaries are unique.
examples:
Card:
summary: Card Payment Response
Bank:
summary: Bank Account Payment Response
This avoids the Microcks convention as the names need to be the same but summary does not matter.
Still, I'd call this one a bit unexpected.
I ran Travel Train spec 1.0.0 on CLI version 0.46.2 and got no error message. Resolving as the user no longer runs into an error for this.