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

oav generate-examples generated min and max sets with same title #935

Closed
gaagarwalMS opened this issue Jan 4, 2023 · 7 comments · Fixed by #1054
Closed

oav generate-examples generated min and max sets with same title #935

gaagarwalMS opened this issue Jan 4, 2023 · 7 comments · Fixed by #1054
Assignees

Comments

@gaagarwalMS
Copy link

The generated examples have the same title value for both the min and max set for every operation. So, the cadl compile links (with the x-ms-examples) just one of them in the generated swagger as the other one gets override.

Both the titles in the min and the max set example files should have different titles (maybe with a suffix like _min or _max) so that the CADL links them properly to the swagger during compilation.

@bhaden94
Copy link

bhaden94 commented Jun 13, 2024

Still seeing this issue, which is requiring us to manually update all our generated examples.

@dargilco
Copy link
Member

+1 Still seeing this issue. When I use the tool with my TypeSpec project in azure-rest-api-specs to auto-generate examples, validation fails (locally when running npx tsv . or in CI/CD pipeline), saying a swagger title is used in multiple examples. I have to write a script to edit all the auto-generated swagger examples (there could be many!) to make sure each one has a unique title in order to get a green build of my TypeSpec. This should be an easy tool fix in OAV. Please fix this.

@mikeharder
Copy link
Member

@dargilco: Can you please add instructions to reproduce the issue?

@dargilco
Copy link
Member

Repro steps:

  • Open a console window at the root of your azure-rest-api-specs clone
  • git checkout dargilco/azure-ai-client
  • cd specification\ai\data-plane\Azure.AI.Client\preview\2024-07-01-preview
  • oav generate-examples azure-ai-client.json

Look at any generated _MaximumSet and _MinimumSet swagger example, and notice they have the same value for "title" at the top.
For example, look at these two:
type examples\Evaluations_DeleteSchedule_MaximumSet_Gen.json
type examples\Evaluations_DeleteSchedule_MinimumSet_Gen.json
They both have the title "Evaluations_DeleteSchedule",

If you try to commit those files to a TypeSpec PR, the pipeline will error out pointing out all the titles that are used in more than one example swagger.

I don't know of an easy way right now to show this error locally.

@dargilco
Copy link
Member

Also, unrealted, note that I need to run the npx prettier --write .\Endpoints_ListSecrets_MaximumSet_Gen.json on each one of the examples, since the auto-generated example is not formatted correctly according to validation checks in the TypeSpec PR CI/CD pipeline. I'll open a separate GitHub issue on that.

@mikeharder mikeharder self-assigned this Oct 14, 2024
@mikeharder mikeharder moved this from 🤔 Triage to 🐝 Dev in Azure SDK EngSys 🚢🎉 Oct 14, 2024
@mikeharder
Copy link
Member

Working on a fix

@dargilco
Copy link
Member

Thank you @mikeharder, I appreciate it!

mikeharder added a commit that referenced this issue Oct 15, 2024
- Fixes #935 
- Uses unique titles when first generating examples
- Still has unrelated bugs where title can be changed when updating existing examples
@github-project-automation github-project-automation bot moved this from 🐝 Dev to 🎊 Closed in Azure SDK EngSys 🚢🎉 Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants