Redocly / redocly-cli

⚒️ Redocly CLI makes OpenAPI easy. Lint/validate to any standard, generate beautiful docs, and more.
https://redocly.com/docs/cli/
MIT License
852 stars 129 forks source link

example is not bundled #1510

Closed ckw28502 closed 3 months ago

ckw28502 commented 3 months ago

Hi, this is my first time using any openapi but i am faced with this problem.

Screenshot 2024-04-02 095655

So image above is the openapi.yaml files. for the parameters, i referenced them to another yaml files. Lets take the settlement for Austria for example The settlement is referenced to a file at this location : "./parameters/location/settlement/AT.yaml"

Screenshot 2024-04-02 095828 This is the referenced settlement for Austria file. It has example and another reference to settlement.yaml. settlement.yaml is used for every country including Austria.

Screenshot 2024-04-02 100133 This is the settlement.yaml file

The problem occur after i bundle them using this command

 npx @redocly/openapi-cli bundle public_api/v2/openapi/openapi.yaml -o openapi.yaml -d --remove-unused-components

after that, the example is not shown in the bundled yaml file Screenshot 2024-04-02 100456

Is there something i did wrong? because it works fine when im using swagger but this problem occured when using Redocly

tatomyr commented 3 months ago

Hi @ckw28502! You're using a reference object which could only contain a summary and a description alongside the $ref. All other fields shall be ignored. So you're not supposed to extend the $ref with required or example properties.

However, I see that the required gets projected to the parameters and that actually looks like a bug to me. There's already another issue on that, so I'm closing this one. Feel free to add your comments there or reply here in case I'm missing something.