Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Generate unique names for synthesized schemas like ContentType #358

Merged
merged 2 commits into from
Oct 20, 2020

Conversation

daviwil
Copy link
Contributor

@daviwil daviwil commented Oct 20, 2020

This change addresses an issue found by @ShivangiReja when using a newer version of the Form Recognizer spec. When the always-create-content-type-parameter option is used and image/bmp content type is added to only one of the 3 operations that accept image types, an additional SealedChoiceSchema with the name ContentType is created, causing the "checker" phase to fail with a duplicate schema name. This is also possible when synthesizing Accept headers.

The fix is to ensure uniqueness of these generated header names by adding logic to increment a numeric suffix that gets applied when more than one schema with a particular name is created.

Copy link
Member

@fearthecowboy fearthecowboy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@daviwil daviwil closed this Oct 20, 2020
@daviwil daviwil reopened this Oct 20, 2020
@azure-pipelines
Copy link

You may test this build by running autorest --reset and then either:


add --use: to the command line:

autorest --use:https://tinyurl.com/y5w8lhky ...


or use the following in your autorest configuration:

use-extension:
  "@autorest/modelerfour": "https://tinyurl.com/y5w8lhky" 

If this build is good for you, give this comment a thumbs up. (👍)

And you should run autorest --reset again once you're finished testing to remove it.

@ShivangiReja
Copy link
Member

looks great @daviwil! I'm able to generate Form Recognizer using the newer version correctly with this change.

@daviwil
Copy link
Contributor Author

daviwil commented Oct 20, 2020

Awesome, thanks @ShivangiReja!

@azure-pipelines
Copy link

You may test this build by running autorest --reset and then either:


add --use: to the command line:

autorest --use:https://tinyurl.com/y3jnnhul ...


or use the following in your autorest configuration:

use-extension:
  "@autorest/modelerfour": "https://tinyurl.com/y3jnnhul" 

If this build is good for you, give this comment a thumbs up. (👍)

And you should run autorest --reset again once you're finished testing to remove it.

@daviwil daviwil merged commit 40cd4d8 into Azure:master Oct 20, 2020
@daviwil daviwil deleted the unique-synthesized-schema-names branch October 20, 2020 22:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants