-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Improve redis Swagger. #2969
Improve redis Swagger. #2969
Conversation
Automation for azure-sdk-for-pythonThe initial PR has been merged into your service PR: |
Automation for azure-libraries-for-javaThe initial PR has been merged into your service PR: |
Automation for azure-sdk-for-nodeEncountered a Subprocess error: (azure-sdk-for-node)
Command: ['/usr/local/bin/autorest', '/tmp/tmpnwblaga6/rest/specification/redis/resource-manager/readme.md', '--license-header=MICROSOFT_MIT_NO_VERSION', '--node-sdks-folder=/tmp/tmpnwblaga6/sdk', '--nodejs', '--use=@microsoft.azure/autorest.nodejs@^2.1.43'] AutoRest code generation utility [version: 2.0.4262; node: v7.10.1]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
Loading AutoRest core '/root/.autorest/@microsoft.azure_autorest-core@2.0.4272/node_modules/@microsoft.azure/autorest-core/dist' (2.0.4272)
Loading AutoRest extension '@microsoft.azure/autorest.nodejs' (^2.1.43->2.1.46)
Loading AutoRest extension '@microsoft.azure/autorest.modeler' (2.3.44->2.3.44)
FATAL: System.InvalidOperationException: Sequence contains no matching element
at System.Linq.Enumerable.First[TSource](IEnumerable1 source, Func2 predicate)
at AutoRest.Extensions.SwaggerExtensions.RemoveUnreferencedTypes(CodeModel codeModel, HashSet`1 typeNames)
at AutoRest.Extensions.SwaggerExtensions.FlattenModels(CodeModel codeModel)
at AutoRest.Extensions.Azure.AzureExtensions.NormalizeAzureClientModel(CodeModel codeModel)
at AutoRest.NodeJS.Azure.TransformerJsa.AutoRest.Core.ITransformer<AutoRest.NodeJS.Azure.Model.CodeModelJsa>.TransformCodeModel(CodeModel cm) in Z:\PUBLISHwybeg\46_20180403T154736\autorest.nodejs\src\azure\TransformerJsa.cs:line 34
at AutoRest.NodeJS.Program.<ProcessInternal>d__3.MoveNext() in Z:\PUBLISHwybeg\46_20180403T154736\autorest.nodejs\src\Program.cs:line 125
--- 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.<Process>d__15.MoveNext()
FATAL: nodejs/generate - FAILED
FATAL: Error: Plugin nodejs reported failure.
Process() cancelled due to exception : Plugin nodejs reported failure.
Error: Plugin nodejs reported failure. |
Automation for azure-sdk-for-goA PR has been created for you based on this PR content. Once this PR will be merged, content will be added to your service PR: |
AutoRest linter results for ARM Related Validation Errors/WarningsThese errors are reported by the ARM team's validation tools, reachout to ARM RP API Review directly for any questions or concerns. File: specification/redis/resource-manager/readme.md
|
AutoRest linter results for SDK Related Validation Errors/WarningsThese errors are reported by the SDK team's validation tools, reachout to ADX Swagger Reviewers directly for any questions or concerns. File: specification/redis/resource-manager/readme.md
|
c23f54a
to
d7abeaa
Compare
AutoRest linter results for ARM Related Validation Errors/WarningsThese errors are reported by the ARM team's validation tools, reachout to ARM RP API Review directly for any questions or concerns. File: specification/redis/resource-manager/readme.md
|
AutoRest linter results for SDK Related Validation Errors/WarningsThese errors are reported by the SDK team's validation tools, reachout to ADX Swagger Reviewers directly for any questions or concerns. File: specification/redis/resource-manager/readme.md
|
AutoRest linter results for ARM Related Validation Errors/WarningsThese errors are reported by the ARM team's validation tools, reachout to ARM RP API Review directly for any questions or concerns. File: specification/redis/resource-manager/readme.md
|
AutoRest linter results for SDK Related Validation Errors/WarningsThese errors are reported by the SDK team's validation tools, reachout to ADX Swagger Reviewers directly for any questions or concerns. File: specification/redis/resource-manager/readme.md
|
Autorest node generator appears to be crashing:
|
"properties": { | ||
"name": { | ||
"type": "string", | ||
"description": "Resource name." | ||
}, | ||
"type": { | ||
"type": "string", | ||
"description": "Resource type." | ||
"description": "Resource type to check name availability of, e.g. 'Microsoft.Cache/redis'.", | ||
"enum": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it okay to keep this as string? Changing the type from string to enum (even with modelAsString) will be a breaking change in many languages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jhendrixMSFT What say you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm torn on this as breaking changes stink however in this case there was no clue what to pass for the value (I had to look at the checked in example JSON to figure it out). If we really don't want to take the breaking change then the doc string will have to be the source of truth.
Another thing to consider, if this param will only ever have the value "Microsoft.Cache/redis" then if you mark it "modelAsString": false
AutoRest should treat it as a constant and remove the param entirely (i.e. hard-coding the value in the request).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jhendrixMSFT
For this api-version we don't have any other resource types, and if we ever have a new resource we can use a new api-version for it. So I think it's fine to treat it as a constant.
Let's try that out and see if that makes everyone happy!
/cc @jianghaolu
AutoRest linter results for ARM Related Validation Errors/WarningsThese errors are reported by the ARM team's validation tools, reachout to ARM RP API Review directly for any questions or concerns. File: specification/redis/resource-manager/readme.md
|
AutoRest linter results for SDK Related Validation Errors/WarningsThese errors are reported by the SDK team's validation tools, reachout to ADX Swagger Reviewers directly for any questions or concerns. File: specification/redis/resource-manager/readme.md
|
I see linter validation errors.. ` { code: 'REQUEST_VALIDATION_ERROR', id: 'OAV109', message: 'Found errors in validating the request for x-ms-example "RedisCacheList" in operation "Redis_CheckNameAvailability".', innerErrors: [ { code: 'INVALID_REQUEST_PARAMETER',
{ AssertionError [ERR_ASSERTION]: swagger "specification/redis/resource-manager/Microsoft.Cache/stable/2018-03-01/redis.json" contains model validation errors.
generatedMessage: false, name: 'AssertionError [ERR_ASSERTION]', code: 'ERR_ASSERTION', actual: false, expected: true, operator: '==' } 1 passing (3s) 1 failing
|
4f7e77b
to
cdc4da5
Compare
AutoRest linter results for ARM Related Validation Errors/WarningsThese errors are reported by the ARM team's validation tools, reachout to ARM RP API Review directly for any questions or concerns. File: specification/redis/resource-manager/readme.md
|
AutoRest linter results for SDK Related Validation Errors/WarningsThese errors are reported by the SDK team's validation tools, reachout to ADX Swagger Reviewers directly for any questions or concerns. File: specification/redis/resource-manager/readme.md
|
@jhendrixMSFT @jianghaolu If it were possible, I would rather do this in a non-breaking way (i.e. keep it string) but with a 'default' parameter value supplied, so that anyone writing new code wouldn't have to feel confused about what type to supply. Do you know if that is possible? |
The question of default value has come up before and I don't believe there is support for this. So if we want to do it in a non-breaking way the only real option that I know of is to update the comment like you already did. |
@jhendrixMSFT Given that we have other issues with CheckNameAvailability, which might be another breaking change, and a new api-version to fix (I refer to #2981) I think the best thing to do is NOT do any breaking change to the generated code for this api-version, but just document it for this api version and CONSIDER modeling it as an enum next api-version, and then people will hopefully notice the return type is changing at the same time as they are fixing up build issues for the number of arguments change. So, for this PR, I am just going to improve the documentation, and revert the model as enum changes. I hope this makes sense. |
…zure#2968. Documenting the 'CheckNameAvailability.type' property better to address Azure#2967 (and marking properties as required). Also using a more realistic timespan value in the PatchSchedule examples.
cdc4da5
to
44e3bae
Compare
AutoRest linter results for SDK Related Validation Errors/WarningsThese errors are reported by the SDK team's validation tools, reachout to ADX Swagger Reviewers directly for any questions or concerns. File: specification/redis/resource-manager/readme.md
|
AutoRest linter results for ARM Related Validation Errors/WarningsThese errors are reported by the ARM team's validation tools, reachout to ARM RP API Review directly for any questions or concerns. File: specification/redis/resource-manager/readme.md
|
@jhendrixMSFT @jianghaolu Is this PR good enough now? |
@jhendrixMSFT @jianghaolu Thanks for the review! |
Documenting list all patchSchedules to fix #2968. Documenting the CheckNameAvailability.type property better to fix #2967. And using a realistic timespan value in PatchSchedule examples.
This checklist is used to make sure that common issues in a pull request are addressed. This will expedite the process of getting your pull request merged and avoid extra work on your part to fix issues discovered during the review process.
PR information
api-version
in the path should match theapi-version
in the spec).Quality of Swagger
/cc @SiddharthChatrolaMs