Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

iscai-msft
Copy link
Contributor

@iscai-msft iscai-msft commented Jun 16, 2020

The fix that added this broke autorest generation. This is because path parameters need to be required here's the swagger link describing this. Since key-version is required for all of the other calls in 7.0, and because getKey also has key-version as required in the other versions (i.e., 7.1-preview), I'm switching it back to required

@openapi-pipeline-app
Copy link

openapi-pipeline-app bot commented Jun 16, 2020

Swagger pipeline restarted successfully, please wait for status update in this comment.

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@openapi-sdkautomation
Copy link

openapi-sdkautomation bot commented Jun 16, 2020

Azure CLI Extension Generation - Release

No readme.md specification configuration files were found that are associated with the files modified in this pull request, or swagger_to_sdk section in readme.md is not configured

@openapi-sdkautomation
Copy link

openapi-sdkautomation bot commented Jun 16, 2020

azure-sdk-for-go - Release

failed [Logs] [Expand Details]
  • Generate from e66d1a9 with merge commit b62fff3. SDK Automation 13.0.17.20200605.3
    [AutoRest] FATAL: System.InvalidOperationException: Swagger document contains two or more x-ms-enum extensions with the same name 'JsonWebKeyType' and different values: EC,EC-HSM,RSA,RSA-HSM,oct,oct-HSM vs. RSA,RSA-HSM
    [AutoRest]    at AutoRest.Modeler.ObjectBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\ObjectBuilder.cs:line 147
    [AutoRest]    at AutoRest.Modeler.SchemaBuilder.ParentBuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SchemaBuilder.cs:line 204
    [AutoRest]    at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SchemaBuilder.cs:line 46
    [AutoRest]    at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SchemaBuilder.cs:line 131
    [AutoRest]    at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SchemaBuilder.cs:line 131
    [AutoRest]    at AutoRest.Modeler.ObjectBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\ObjectBuilder.cs:line 179
    [AutoRest]    at AutoRest.Modeler.SchemaBuilder.ParentBuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SchemaBuilder.cs:line 204
    [AutoRest]    at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SchemaBuilder.cs:line 46
    [AutoRest]    at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SchemaBuilder.cs:line 131
    [AutoRest]    at AutoRest.Modeler.SwaggerModeler.BuildCompositeTypes() in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SwaggerModeler.cs:line 271
    [AutoRest]    at AutoRest.Modeler.SwaggerModeler.Build(ServiceDefinition serviceDefinition) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SwaggerModeler.cs:line 66
    [AutoRest]    at AutoRest.Modeler.Program.d__2.MoveNext() in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\Program.cs:line 60
    [AutoRest] --- End of stack trace from previous location where exception was thrown ---
    [AutoRest]    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    [AutoRest]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    [AutoRest]    at NewPlugin.d__15.MoveNext()
    [AutoRest] FATAL: go/imodeler1 - FAILED
    [AutoRest] FATAL: Error: Plugin imodeler1 reported failure.
    [AutoRest] Failure during batch task - {"tag":"package-7.2-preview"} -- Error: Plugin imodeler1 reported failure..
    [AutoRest]   Error: Plugin imodeler1 reported failure.
    Failed to run autorest.
    Error: /z/node_modules/.bin/autorest [email protected]/autorest.go@~2.1.145 --go --verbose --multiapi --use-onever --preview-chk --version=previous --go-sdk-folder=/z/work/src/github.com/Azure/azure-sdk-for-go /z/work/azure-rest-api-specs/specification/keyvault/data-plane/readme.md FATAL: System.InvalidOperationException: Swagger document contains two or more x-ms-enum extensions with the same name 'JsonWebKeyType' and different values: EC,EC-HSM,RSA,RSA-HSM,oct,oct-HSM vs. RSA,RSA-HSM
       at AutoRest.Modeler.ObjectBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\ObjectBuilder.cs:line 147
       at AutoRest.Modeler.SchemaBuilder.ParentBuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SchemaBuilder.cs:line 204
       at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SchemaBuilder.cs:line 46
       at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SchemaBuilder.cs:line 131
       at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SchemaBuilder.cs:line 131
       at AutoRest.Modeler.ObjectBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\ObjectBuilder.cs:line 179
       at AutoRest.Modeler.SchemaBuilder.ParentBuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SchemaBuilder.cs:line 204
       at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SchemaBuilder.cs:line 46
       at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SchemaBuilder.cs:line 131
       at AutoRest.Modeler.SwaggerModeler.BuildCompositeTypes() in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SwaggerModeler.cs:line 271
       at AutoRest.Modeler.SwaggerModeler.Build(ServiceDefinition serviceDefinition) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SwaggerModeler.cs:line 66
       at AutoRest.Modeler.Program.d__2.MoveNext() in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\Program.cs:line 60
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at NewPlugin.d__15.MoveNext()
    FATAL: go/imodeler1 - FAILED
    FATAL: Error: Plugin imodeler1 reported failure.
    Failure during batch task - {"tag":"package-7.2-preview"} -- Error: Plugin imodeler1 reported failure..
      Error: Plugin imodeler1 reported failure.
    , {} 
    Failed to find any diff after autorest so no changed packages was found.

@openapi-sdkautomation
Copy link

openapi-sdkautomation bot commented Jun 16, 2020

azure-sdk-for-net - Release

No readme.md specification configuration files were found that are associated with the files modified in this pull request, or swagger_to_sdk section in readme.md is not configured

@openapi-sdkautomation
Copy link

openapi-sdkautomation bot commented Jun 16, 2020

Trenton Generation - Release

No readme.md specification configuration files were found that are associated with the files modified in this pull request, or swagger_to_sdk section in readme.md is not configured

@openapi-sdkautomation
Copy link

openapi-sdkautomation bot commented Jun 16, 2020

azure-sdk-for-python - Release

No readme.md specification configuration files were found that are associated with the files modified in this pull request, or swagger_to_sdk section in readme.md is not configured

@openapi-sdkautomation
Copy link

openapi-sdkautomation bot commented Jun 16, 2020

azure-sdk-for-js - Release

No readme.md specification configuration files were found that are associated with the files modified in this pull request, or swagger_to_sdk section in readme.md is not configured

@openapi-sdkautomation
Copy link

openapi-sdkautomation bot commented Jun 16, 2020

azure-sdk-for-java - Release

No readme.md specification configuration files were found that are associated with the files modified in this pull request, or swagger_to_sdk section in readme.md is not configured

@azuresdkci
Copy link
Contributor

Can one of the admins verify this patch?

@daviwil
Copy link
Contributor

daviwil commented Jun 16, 2020

Yep, "required": false is invalid Swagger for path parameters according to the OpenAPI v2 specification's Parameter object required field:

Determines whether this parameter is mandatory. If the parameter is in "path", this property is required and its value MUST be true.

https://swagger.io/specification/v2/#parameterObject

@heaths
Copy link
Member

heaths commented Jun 16, 2020

But it's never actually been required. Our SDK even treats it as optional. If you don't specify it, the "latest" is assumed which is the correct behavior. This was changed to reflect reality.

@heaths
Copy link
Member

heaths commented Jun 16, 2020

Talking with @iscai-msft offline, I see this path parameters are required to be required: true, so maybe we just need to change this back and treat it as optional in our client SDKs anyway. @johanste, thoughts here?

@daviwil
Copy link
Contributor

daviwil commented Jun 16, 2020

My interpretation is that if a path parameter is meant to optional, you should use a separate definition for /keys/{key-name} which doesn't specify {key-version}. Granted, this would require a new operationId since it's being defined under a different path than GetKey.

@johanste
Copy link
Member

This should be two paths - one with version, one without. Path parameters are indeed required.

@jlichwa
Copy link
Contributor

jlichwa commented Jun 16, 2020

We need our REST API docs to represent reality. So customers know how to use our API. Today version is optional across REST API, SDKs.

@johanste
Copy link
Member

But it is two different endpoints/routes:

/keys/{key-name}

and

/keys/{key-name}/{key-version}

and should in reality be described as such in order to have a valid openapi document.

Given that this invalid openapi document accidentally "worked" before, we do have a problem here in that we probably want to keep a single overload of the method in generated code. Ideally, we can correct the document so that it is actually valid without changing what code gets generated.

@heaths
Copy link
Member

heaths commented Jun 16, 2020

Given the alternative, making this required: true again and documenting it's actually optional is probably the best course of action. Adding a new path for generated languages would actually cause more churn than what we currently have.

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@tjprescott
Copy link
Member

@johanste @heaths if you are both satisfied with this change, @lmazuel will need to merge it. I don't have sufficient Github permissions to merge this.

@jlichwa
Copy link
Contributor

jlichwa commented Jun 17, 2020

Once we on it, can we just use the same comment across all types and propagate across future versions 7.1 and 7.2, so it is not lost.

@iscai-msft
Copy link
Contributor Author

Will do. @jlichwa when you say "across all types", do you mean key-version is always optional across all operations?

@jlichwa
Copy link
Contributor

jlichwa commented Jun 17, 2020

@iscai-msft I meant that same logic applies for all types:operations: GetCertificate,GetSecret . So we can add this comment to those too:"Though listed as required following OpenAPI guidelines for path parameters, actually optional on the server, which assumes 'latest' if not provided."

If we can copy paste this comment to above types, that would be very beneficial

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@iscai-msft
Copy link
Contributor Author

@jlichwa added the clarifying comment to GetKey, GetSecret, and GetCertificate for API version 7.0, 7.1-preview, and 7.2-preview. Let me know if the fixes are good, thanks!

@openapi-sdkautomation
Copy link

openapi-sdkautomation bot commented Jun 17, 2020

azure-sdk-for-python-track2 - Release

No readme.md specification configuration files were found that are associated with the files modified in this pull request, or swagger_to_sdk section in readme.md is not configured

@jlichwa
Copy link
Contributor

jlichwa commented Jun 17, 2020

@jlichwa added the clarifying comment to GetKey, GetSecret, and GetCertificate for API version 7.0, 7.1-preview, and 7.2-preview. Let me know if the fixes are good, thanks!

That is great. Thank you so much

@msfcolombo
Copy link
Contributor

I have some reserves about using the following as documentation:

Though listed as required following OpenAPI guidelines for path parameters, actually optional on the server, which assumes 'latest' if not provided.

The vast majority of readers don't know or don't care about OpenAPI. When they read, they want to learn exact semantics of this API, regardless of standards. Therefore I think we should document as something like:

This URI fragment is optional. If not specified, the latest version of the [certificate/key/secret] is returned

@iscai-msft
Copy link
Contributor Author

@msfcolombo I see where you're coming from, I'll change the comment to that for better customer readability. Thanks!

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@iscai-msft
Copy link
Contributor Author

@msfcolombo, implemented the changes you requested. lmk what you think!

@iscai-msft iscai-msft requested a review from msfcolombo June 17, 2020 17:50
…into fix_7.0_keyvault

* 'master' of https://github.com/Azure/azure-rest-api-specs:
  Security domain backup restore REST OpenAPI specification (#9647)
  Revert PYthon Directive Change (#9801)
  test-costmanagement-automation (#9864)
  1. Marked "sessionId" as required property in DataFlowDebugCommandRequest (#9850)
  updated containerinstance owner (#9856)
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@lmazuel lmazuel merged commit b62fff3 into Azure:master Jun 17, 2020
00Kai0 pushed a commit to 00Kai0/azure-rest-api-specs that referenced this pull request Oct 12, 2020
…re#9860)

* make key version required for get key

* fix description

* add clarifying comment about version path parameter to Get* methods in version 7.0 and up

* remove references to OpenAPI version in version path parameter desccription
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.

9 participants