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

Handle x-ms-mutability swagger extension #436

Merged
merged 1 commit into from
Sep 30, 2021
Merged

Handle x-ms-mutability swagger extension #436

merged 1 commit into from
Sep 30, 2021

Conversation

anthony-c-martin
Copy link
Member

Closes #240

@codecov-commenter
Copy link

Codecov Report

Merging #436 (ea4f3fb) into main (ca4d6ba) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #436   +/-   ##
=======================================
  Coverage   95.23%   95.23%           
=======================================
  Files          17       17           
  Lines         252      252           
=======================================
  Hits          240      240           
  Misses         12       12           
Flag Coverage Δ
dotnet 95.23% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@@ -294,13 +294,37 @@ export function generateTypes(host: Host, definition: ProviderDefinition) {
return factory.lookupBuiltInType(BuiltInTypeKind.Any);
}

function getMutabilityFlags(property: Property | undefined) {
const mutability = property?.extensions?.["x-ms-mutability"] as string[];
Copy link
Member

@majastrz majastrz Sep 30, 2021

Choose a reason for hiding this comment

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

x-ms-mutability

I think you also need to handle x-ms-secret: true and format: password cases. I sent you an IM about how we're dealing with that in an internal repo that is partially applicable.

If something is considered secret, we should assume write only and it should take precedence over whatever x-ms-mutability settings in the swagger.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've raised #437 to track this separately as this PR is just to fix a specific scenario. I feel like the handling of x-ms-secret in types needs a bit more discussion.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle mutability and secret annotations in type generation
3 participants