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

EventGridv2 TypeSpec Api Preview #23204

Merged
merged 38 commits into from
May 22, 2023
Merged

EventGridv2 TypeSpec Api Preview #23204

merged 38 commits into from
May 22, 2023

Conversation

l0lawrence
Copy link
Member

@l0lawrence l0lawrence commented Mar 21, 2023

See #23200

@l0lawrence l0lawrence requested a review from lmazuel March 21, 2023 23:18
@openapi-workflow-bot
Copy link

Hi, @l0lawrence Thanks for your PR. I am workflow bot for review process. Here are some small tips.

  • Please ensure to do self-check against checklists in first PR comment.
  • PR assignee is the person auto-assigned and responsible for your current PR reviewing and merging.
  • For specs comparison cross API versions, Use API Specs Comparison Report Generator
  • If there is CI failure(s), to fix CI error(s) is mandatory for PR merging; or you need to provide justification in PR comment for explanation. How to fix?

  • Any feedback about review process or workflow bot, pls contact swagger and tools team. vscswagger@microsoft.com

    @openapi-pipeline-app
    Copy link

    openapi-pipeline-app bot commented Mar 21, 2023

    Swagger Validation Report

    ️️✔️BreakingChange succeeded [Detail] [Expand]
    There are no breaking changes.
    ️❌Breaking Change(Cross-Version): 1 Errors, 0 Warnings failed [Detail] The following breaking changes are detected by comparison with the latest stable version:
    Rule Message
    Runtime Exception "new":"https://github.com/Azure/azure-rest-api-specs/blob/4b1d4a0e3b95152fb0aca665b17e9489c6f5749d/specification/eventgrid/data-plane/Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json",
    "old":"https://github.com/Azure/azure-rest-api-specs/blob/main/specification/eventgrid/data-plane/Microsoft.EventGrid/stable/2018-01-01/EventGrid.json",
    "details":"Command failed: node "/mnt/vss/_work/_tasks/AzureApiValidation_5654d05d-82c1-48da-ad8f-161b817f6d41/0.0.54/common/temp/node_modules/.pnpm/@Azure+oad@0.10.4/node_modules/autorest/dist/app.js" --v2 --input-file=/mnt/vss/_work/1/cross-version-c93b354fd9c14905bb574a8834c4d69b/specification/eventgrid/data-plane/Microsoft.EventGrid/stable/2018-01-01/EventGrid.json --output-artifact=swagger-document.json --output-artifact=swagger-document.map --output-file=old --output-folder=/tmp\nERROR: Schema violation: Additional properties not allowed: ?overload=customEvent,
    ?overload=cloudEvent,
    ?overload=EventGridEvent\n - file:///mnt/vss/_work/1/cross-version-c93b354fd9c14905bb574a8834c4d69b/specification/eventgrid/data-plane/Microsoft.EventGrid/stable/2018-01-01/EventGrid.json:33:2 ($["x-ms-paths"])\nFATAL: swagger-document/individual/schema-validator - FAILED\nFATAL: Error: [OperationAbortedException] Error occurred. Exiting.\nProcess() cancelled due to exception : [OperationAbortedException] Error occurred. Exiting.\n"
    ️️✔️CredScan succeeded [Detail] [Expand]
    There is no credential detected.
    ️❌LintDiff: 1 Errors, 27 Warnings failed [Detail]
    compared tags (via openapi-validator v2.1.2) new version base version
    package-2023-06-01-preview package-2023-06-01-preview(4b1d4a0) default(main)

    [must fix]The following errors/warnings are introduced by current PR:

    Rule Message Related RPC [For API reviewers]
    XmsPathsMustOverloadPaths Paths in x-ms-paths must overload a normal path in the paths section, i.e. a path in the x-ms-paths must either be same as a path in the paths section or a path in the paths sections followed by additional parameters.
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L286
    ⚠️ SecurityDefinitionDescription Security definition should have a description.
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L43
    ⚠️ ListInOperationName Since operation response has model definition in array type, it should be of the form '_list'.
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L52
    ⚠️ PaginationResponse Operation might be pageable. Consider adding the x-ms-pageable extension.
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L52
    ⚠️ XmsExamplesRequired Please provide x-ms-examples describing minimum/maximum property set for response/request payloads for operations.
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L52
    ⚠️ OperationId OperationId should be of the form 'Noun_Verb'
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L53
    ⚠️ PathParameterSchema Path parameter should specify a maximum length (maxLength) and characters allowed (pattern).
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L59
    ⚠️ PathParameterSchema Path parameter should specify a maximum length (maxLength) and characters allowed (pattern).
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L66
    ⚠️ PaginationResponse Operation might be pageable. Consider adding the x-ms-pageable extension.
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L114
    ⚠️ XmsExamplesRequired Please provide x-ms-examples describing minimum/maximum property set for response/request payloads for operations.
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L114
    ⚠️ OperationId OperationId should be of the form 'Noun_Verb'
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L115
    ⚠️ PathParameterSchema Path parameter should specify a maximum length (maxLength) and characters allowed (pattern).
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L121
    ⚠️ PathParameterSchema Path parameter should specify a maximum length (maxLength) and characters allowed (pattern).
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L128
    ⚠️ PaginationResponse Operation might be pageable. Consider adding the x-ms-pageable extension.
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L171
    ⚠️ XmsExamplesRequired Please provide x-ms-examples describing minimum/maximum property set for response/request payloads for operations.
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L171
    ⚠️ OperationId OperationId should be of the form 'Noun_Verb'
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L172
    ⚠️ PathParameterSchema Path parameter should specify a maximum length (maxLength) and characters allowed (pattern).
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L178
    ⚠️ PathParameterSchema Path parameter should specify a maximum length (maxLength) and characters allowed (pattern).
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L185
    ⚠️ PaginationResponse Operation might be pageable. Consider adding the x-ms-pageable extension.
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L228
    ⚠️ XmsExamplesRequired Please provide x-ms-examples describing minimum/maximum property set for response/request payloads for operations.
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L228
    ⚠️ OperationId OperationId should be of the form 'Noun_Verb'
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L229
    ⚠️ PathParameterSchema Path parameter should specify a maximum length (maxLength) and characters allowed (pattern).
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L235
    ⚠️ PathParameterSchema Path parameter should specify a maximum length (maxLength) and characters allowed (pattern).
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L242
    ⚠️ XmsExamplesRequired Please provide x-ms-examples describing minimum/maximum property set for response/request payloads for operations.
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L287
    ⚠️ SchemaNamesConvention Schema name should be Pascal case.
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L386
    ⚠️ SchemaNamesConvention Schema name should be Pascal case.
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L422
    ⚠️ SchemaNamesConvention Schema name should be Pascal case.
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L435
    ⚠️ PropertyType Property should have a defined type.
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L482


    The following errors/warnings exist before current PR submission:

    Rule Message
    ⚠️ MsPaths Don't use x-ms-paths except where necessary to support legacy APIs.
    Location: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L285
    ️️✔️Avocado succeeded [Detail] [Expand]
    Validation passes for Avocado.
    ️️✔️ApiReadinessCheck succeeded [Detail] [Expand]
    ️⚠️~[Staging] ServiceAPIReadinessTest: 0 Warnings warning [Detail]

    API Test is not triggered due to precheck failure. Check pipeline log for details.

    ️️✔️SwaggerAPIView succeeded [Detail] [Expand]
    ️️✔️CadlAPIView succeeded [Detail] [Expand]
    ️️✔️TypeSpecAPIView succeeded [Detail] [Expand]
    ️❌ModelValidation: 5 Errors, 0 Warnings failed [Detail]
    Rule Message
    XMS_EXAMPLE_NOTFOUND_ERROR x-ms-example not found in ReceiveCloudEvents.
    Url: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L52:15
    XMS_EXAMPLE_NOTFOUND_ERROR x-ms-example not found in AcknowledgeCloudEvents.
    Url: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L114:15
    XMS_EXAMPLE_NOTFOUND_ERROR x-ms-example not found in ReleaseCloudEvents.
    Url: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L171:15
    XMS_EXAMPLE_NOTFOUND_ERROR x-ms-example not found in RejectCloudEvents.
    Url: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L228:15
    XMS_EXAMPLE_NOTFOUND_ERROR x-ms-example not found in PublishCloudEvents.
    Url: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L287:15
    ️❌SemanticValidation: 1 Errors, 0 Warnings failed [Detail]
    Rule Message
    MISSING_PATH_PARAMETER_DEFINITION Path parameter is declared but is not defined: apiVersion
    JsonUrl: Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L287:15
    ️️✔️PoliCheck succeeded [Detail] [Expand]
    Validation passed for PoliCheck.
    ️️✔️PrettierCheck succeeded [Detail] [Expand]
    Validation passes for PrettierCheck.
    ️️✔️SpellCheck succeeded [Detail] [Expand]
    Validation passes for SpellCheck.
    ️️✔️Lint(RPaaS) succeeded [Detail] [Expand]
    Validation passes for Lint(RPaaS).
    ️️✔️CadlValidation succeeded [Detail] [Expand]
    Validation passes for CadlValidation.
    ️❌TypeSpec Validation: 2 Errors, 20 Warnings failed [Detail]
    Rule Message
    MissingExamplesDirectory "details":"The 'examples' directory is missing in the typespec folder specification/eventgrid/Azure.Messaging.EventGrid,
    please ensure the 'examples' is added in the PR."
    InConsistentSwagger "details":"The generated swagger file EventGrid.json from typespec specification/eventgrid/Azure.Messaging.EventGrid is not the same as the '/mnt/vss/_work/1/azure-rest-api-specs/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2017-06-15-preview/EventGrid.json' in PR,
    please make sure the swagger is consistent with the generated swagger. You can find the difference in the pipeline log."
    ⚠️ deprecated: Deprecated The shared option is deprecated, use the @sharedRoute decorator instead.
    Location: specification/eventgrid/Azure.Messaging.EventGrid/main.tsp#L167
    ⚠️ deprecated: Deprecated The shared option is deprecated, use the @sharedRoute decorator instead.
    Location: specification/eventgrid/Azure.Messaging.EventGrid/main.tsp#L184
    ⚠️ @azure-tools/typespec-azure-core/no-unknown Azure services must not have properties of type unknown.
    Location: specification/eventgrid/Azure.Messaging.EventGrid/main.tsp#L55
    ⚠️ @azure-tools/typespec-azure-core/casing-style The names of Property types must use camelCase
    Location: specification/eventgrid/Azure.Messaging.EventGrid/main.tsp#L58
    ⚠️ @azure-tools/typespec-azure-core/casing-style The names of Operation types must use camelCase
    Location: specification/eventgrid/Azure.Messaging.EventGrid/main.tsp#L167
    ⚠️ @azure-tools/typespec-azure-core/request-body-problem Request body should not be of raw array type. Consider creating a container model that can add properties over time to avoid introducing breaking changes.
    Location: specification/eventgrid/Azure.Messaging.EventGrid/main.tsp#L195
    ⚠️ @azure-tools/typespec-azure-core/casing-style The names of Operation types must use camelCase
    Location: specification/eventgrid/Azure.Messaging.EventGrid/main.tsp#L184
    ⚠️ @azure-tools/typespec-azure-core/request-body-problem Request body should not be of raw array type. Consider creating a container model that can add properties over time to avoid introducing breaking changes.
    Location: specification/eventgrid/Azure.Messaging.EventGrid/main.tsp#L195
    ⚠️ @azure-tools/typespec-azure-core/request-body-problem Request body should not be of raw array type. Consider creating a container model that can add properties over time to avoid introducing breaking changes.
    Location: specification/eventgrid/Azure.Messaging.EventGrid/main.tsp#L195
    ⚠️ @azure-tools/typespec-azure-core/casing-style The names of Operation types must use camelCase
    Location: specification/eventgrid/Azure.Messaging.EventGrid/main.tsp#L203
    ⚠️ @azure-tools/typespec-azure-core/casing-style The names of Operation types must use camelCase
    Location: specification/eventgrid/Azure.Messaging.EventGrid/main.tsp#L227
    ⚠️ @azure-tools/typespec-azure-core/casing-style The names of Operation types must use camelCase
    Location: specification/eventgrid/Azure.Messaging.EventGrid/main.tsp#L251
    ⚠️ @azure-tools/typespec-azure-core/casing-style The names of Operation types must use camelCase
    Location: specification/eventgrid/Azure.Messaging.EventGrid/main.tsp#L274
    ⚠️ deprecated: Deprecated The shared option is deprecated, use the @sharedRoute decorator instead.
    Location: specification/eventgrid/Azure.Messaging.EventGrid/main.tsp#L167
    ⚠️ deprecated: Deprecated The shared option is deprecated, use the @sharedRoute decorator instead.
    Location: specification/eventgrid/Azure.Messaging.EventGrid/main.tsp#L184
    ⚠️ deprecated: Deprecated The shared option is deprecated, use the @sharedRoute decorator instead.
    Location: specification/eventgrid/Azure.Messaging.EventGrid/main.tsp#L167
    ⚠️ deprecated: Deprecated The shared option is deprecated, use the @sharedRoute decorator instead.
    Location: specification/eventgrid/Azure.Messaging.EventGrid/main.tsp#L184
    ⚠️ deprecated: Deprecated The shared option is deprecated, use the @sharedRoute decorator instead.
    Location: specification/eventgrid/Azure.Messaging.EventGrid/main.tsp#L167
    ⚠️ deprecated: Deprecated The shared option is deprecated, use the @sharedRoute decorator instead.
    Location: specification/eventgrid/Azure.Messaging.EventGrid/main.tsp#L184
    ⚠️ MissingTypeSpecProjectConfig "details":"The configuration 'azure-resource-provider-folder' for '@azure-tools/typespec-autorest' is missing in the tspconfig.yaml under folder specification/eventgrid/Azure.Messaging.EventGrid,
    please ensure it is added in the configuration of the emitter '@azure-tools/typespec-autorest'."
    ️️✔️PR Summary succeeded [Detail] [Expand]
    Validation passes for Summary.
    Posted by Swagger Pipeline | How to fix these errors?

    @ghost ghost added the Event Grid label Mar 21, 2023
    @openapi-pipeline-app
    Copy link

    openapi-pipeline-app bot commented Mar 21, 2023

    Swagger Generation Artifacts

    ️🔄ApiDocPreview inProgress [Detail]
    ️️✔️SDK Breaking Change Tracking succeeded [Detail] [Expand]

    Breaking Changes Tracking


    ️️✔️ azure-sdk-for-net-track2 succeeded [Detail] [Expand]
    ️⚠️ azure-sdk-for-python warning [Detail]
    • ⚠️Warning [Logs]Release - Generate from f6f647a. SDK Automation 14.0.0
      command	sh scripts/automation_init.sh ../azure-sdk-for-python_tmp/initInput.json ../azure-sdk-for-python_tmp/initOutput.json
      cmderr	[automation_init.sh] WARNING: Skipping azure-nspkg as it is not installed.
      warn		specification/eventgrid/data-plane/readme.md skipped due to azure-sdk-for-python not found in swagger-to-sdk
      command	sh scripts/automation_generate.sh ../azure-sdk-for-python_tmp/generateInput.json ../azure-sdk-for-python_tmp/generateOutput.json
      cmderr	[automation_generate.sh] notice
      cmderr	[automation_generate.sh] npm notice New minor version of npm available! 9.5.1 -> 9.6.7
      cmderr	[automation_generate.sh] npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.6.7>
      cmderr	[automation_generate.sh] npm notice Run `npm install -g npm@9.6.7` to update!
      cmderr	[automation_generate.sh] npm notice
    • ️✔️azure-eventgrid [View full logs]  [Release SDK Changes]
      info	[Changelog] data-plan skip changelog generation temporarily
    Posted by Swagger Pipeline | How to fix these errors?

    @openapi-pipeline-app
    Copy link

    openapi-pipeline-app bot commented Mar 21, 2023

    Generated ApiView

    Language Package Name ApiView Link
    Python azure-eventgrid https://apiview.dev/Assemblies/Review/8b946d25af0e4f1392f8b8c5d07c4292
    .Net Azure.Messaging.EventGrid There is no API change compared with the previous version
    .Net Azure.Messaging.EventGrid.Namespaces https://apiview.dev/Assemblies/Review/f521913c79ff4607b152b1b6610e0105

    @lmazuel lmazuel changed the title EventGrid Api EventGridv2 Preview API Mar 21, 2023
    @l0lawrence l0lawrence changed the title EventGridv2 Preview API EventGrid TypeSpec Api Mar 21, 2023
    @l0lawrence l0lawrence changed the title EventGrid TypeSpec Api EventGridv2 TypeSpec Api Preview Mar 21, 2023
    Copy link
    Member

    @mikekistler mikekistler left a comment

    Choose a reason for hiding this comment

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

    Please include the generated OpenAPI in your PR.

    @mikekistler mikekistler linked an issue Mar 24, 2023 that may be closed by this pull request
    specification/eventgrid/typespec/main.tsp Outdated Show resolved Hide resolved
    specification/eventgrid/typespec/main.tsp Outdated Show resolved Hide resolved
    lmazuel and others added 2 commits March 24, 2023 13:36
    Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
    Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
    lmazuel and others added 2 commits March 24, 2023 15:43
    Co-authored-by: Libba Lawrence <llawrence@microsoft.com>
    Co-authored-by: Libba Lawrence <llawrence@microsoft.com>
    @openapi-pipeline-app
    Copy link

    Swagger Generation Artifacts

    ️🔄ApiDocPreview inProgress [Detail]
    ️️✔️SDK Breaking Change Tracking succeeded [Detail] [Expand]

    Breaking Changes Tracking

    ️⌛ azure-sdk-for-net-track2 pending [Detail]
    Posted by Swagger Pipeline | How to fix these errors?

    @doc("Single Cloud Event being published.")
    @body
    event: CloudEvent;
    }, PublishResult>;
    Copy link
    Member

    Choose a reason for hiding this comment

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

    Why do we return an empty object? Can we just don't return anything?

    Copy link
    Member

    Choose a reason for hiding this comment

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

    Is the service really returning {} as the body?

    Copy link
    Member Author

    @l0lawrence l0lawrence May 17, 2023

    Choose a reason for hiding this comment

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

    The service does return a 200 with '{}'. Having the return as a model keeps everything consistent and if publish ever returns anything else the response type is already there

    @mikekistler mikekistler added the TypeSpec Authored with TypeSpec label May 19, 2023
    * encode
    
    * remove num default on duration
    
    ---------
    
    Co-authored-by: Laurent Mazuel <laurent.mazuel@gmail.com>
    @openapi-workflow-bot
    Copy link

    Hi @l0lawrence, Your PR has some issues. Please fix the CI sequentially by following the order of Avocado, semantic validation, model validation, breaking change, lintDiff. If you have any questions, please post your questions in this channel https://aka.ms/swaggersupport.

    TaskHow to fixPriority
    AvocadoFix-AvocadoHigh
    Semantic validationFix-SemanticValidation-ErrorHigh
    Model validationFix-ModelValidation-ErrorHigh
    LintDiffFix-LintDiffhigh
    If you need further help, please feedback via swagger feedback.

    @openapi-workflow-bot
    Copy link

    Hi, @l0lawrence, For review efficiency consideration, when creating a new api version, it is required to place API specs of the base version in the first commit, and push new version updates into successive commits. You can use OpenAPIHub to initialize the PR for adding a new version. For more details refer to the wiki. Or you could onboard API spec pipeline

    * regen off new commit for encode
    
    * reference preview tag
    
    * ignore word
    
    * update readme to have both apis
    
    * update with next autorest
    
    * change format to int32
    Copy link
    Member

    @lmazuel lmazuel left a comment

    Choose a reason for hiding this comment

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

    Merging, as this as good as we can get the CI to be given a few TypeSpec issues

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

    Successfully merging this pull request may close these issues.

    [Azure Event Grid] API Review
    10 participants