Skip to content

required is missing on path parameters #297

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

Closed
baywet opened this issue Oct 18, 2022 · 4 comments
Closed

required is missing on path parameters #297

baywet opened this issue Oct 18, 2022 · 4 comments
Assignees
Labels
priority:p1 High priority but not blocking. Causes major but not critical loss of functionality SLA <=7days type:bug A broken experience
Milestone

Comments

@baywet
Copy link
Member

baywet commented Oct 18, 2022

Short summary (3-5 sentences) describing the issue.

Assemblies affected

1.2.0-preview4

Steps to reproduce

dotnet tool install -g Microsoft.OpenAPI.Kiota --prerelease
kiota show -k msgraph::microsoft-graph

Expected result

No errors about path parameters missing the required property.

Actual result

fail: Kiota.Builder.KiotaBuilder[0]
      OpenApi Parsing error: "required" must be true when parameter location is "path" [#/paths/~1applications~1{application-id}/parameters/1/required]
fail: Kiota.Builder.KiotaBuilder[0]
      OpenApi Parsing error: Declared path parameter "appId" needs to be defined as a path parameter at either the path or operation level [#/paths/~1applications~1{application-id}/parameters/1/in]
fail: Kiota.Builder.KiotaBuilder[0]
      OpenApi Parsing error: "required" must be true when parameter location is "path" [#/paths/~1applications~1{application-id}~1createdOnBehalfOf/parameters/1/required]
fail: Kiota.Builder.KiotaBuilder[0]
      OpenApi Parsing error: Declared path parameter "appId" needs to be defined as a path parameter at either the path or operation level [#/paths/~1applications~1{application-id}~1createdOnBehalfOf/parameters/1/in]
fail: Kiota.Builder.KiotaBuilder[0]
      OpenApi Parsing error: "required" must be true when parameter location is "path" [#/paths/~1applications~1{application-id}~1extensionProperties/parameters/1/required]
fail: Kiota.Builder.KiotaBuilder[0]
      OpenApi Parsing error: Declared path parameter "appId" needs to be defined as a path parameter at either the path or operation level [#/paths/~1applications~1{application-id}~1extensionProperties/parameters/1/in]
fail: Kiota.Builder.KiotaBuilder[0]
      OpenApi Parsing error: "required" must be true when parameter location is "path" [#/paths/~1applications~1{application-id}~1extensionProperties~1{extensionProperty-id}/parameters/1/required]
fail: Kiota.Builder.KiotaBuilder[0]
      OpenApi Parsing error: Declared path parameter "appId" needs to be defined as a path parameter at either the path or operation level [#/paths/~1applications~1{application-id}~1extensionProperties~1{extensionProperty-id}/parameters/1/in]
fail: Kiota.Builder.KiotaBuilder[0]
      OpenApi Parsing error: "required" must be true when parameter location is "path" [#/paths/~1applications~1{application-id}~1extensionProperties~1$count/parameters/1/required]
fail: Kiota.Builder.KiotaBuilder[0]
      OpenApi Parsing error: Declared path parameter "appId" needs to be defined as a path parameter at either the path or operation level [#/paths/~1applications~1{application-id}~1extensionProperties~1$count/parameters/1/in]
fail: Kiota.Builder.KiotaBuilder[0]
      OpenApi Parsing error: "required" must be true when parameter location is "path" [#/paths/~1applications~1{application-id}~1federatedIdentityCredentials/parameters/1/required]
fail: Kiota.Builder.KiotaBuilder[0]
      OpenApi Parsing error: Declared path parameter "appId" needs to be defined as a path parameter at either the path or operation level [#/paths/~1applications~1{application-id}~1federatedIdentityCredentials/parameters/1/in]

(logs truncated for brevity)

Additional detail

This is using the latest open API description for Microsoft Graph which has been using the current version of this library to be generated by the weekly process.

@baywet baywet added type:bug A broken experience priority:p1 High priority but not blocking. Causes major but not critical loss of functionality SLA <=7days labels Oct 18, 2022
@baywet baywet added this to the OData:1.2 milestone Oct 18, 2022
@baywet
Copy link
Member Author

baywet commented Oct 18, 2022

bug seems to have been introduced by #293 which introduced

  '/applications/{application-id}/createdOnBehalfOf':
    description: Provides operations to manage the createdOnBehalfOf property of the microsoft.graph.application entity.
    get:
      tags:
        - applications.directoryObject
      summary: Get createdOnBehalfOf from applications
      description: Supports $filter (eq when counting empty collections). Read-only.
      operationId: applications.GetCreatedOnBehalfOf
      parameters:
        - name: $select
          in: query
          description: Select properties to be returned
          style: form
          explode: false
          schema:
            uniqueItems: true
            type: array
            items:
              enum:
                - id
                - deletedDateTime
              type: string
        - name: $expand
          in: query
          description: Expand related entities
          style: form
          explode: false
          schema:
            uniqueItems: true
            type: array
            items:
              enum:
                - '*'
              type: string
      responses:
        2XX:
          description: Retrieved navigation property
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/microsoft.graph.directoryObject'
        4XX:
          $ref: '#/components/responses/error'
        5XX:
          $ref: '#/components/responses/error'
      x-ms-docs-operation-type: operation
    parameters:
      - name: application-id
        in: path
        description: 'key: id of application'
        required: true
        style: simple
        schema:
          type: string
        x-ms-docs-key-type: application
+      - name: appId
+        in: path
+        description: 'Alternate key: appId of application'
+        style: simple
+        schema:
+          type: string
+          nullable: true

CC @millicentachieng

@peombwa
Copy link
Contributor

peombwa commented Oct 19, 2022

This is also affecting PowerShell module - microsoftgraph/msgraph-sdk-powershell#1577 (review).

How is the alternate key (appId) supposed to be used in the context of OAS 3? There is no direct equivalent of OData's AlternateKeys term in OAS 3 that I can think of. Aliasing of parameters is still an open feature request for OAS - OAI/OpenAPI-Specification#2298.

@irvinesunday
Copy link
Contributor

This is also potentially affecting Go and PowerShell snippets in GE: microsoftgraph/microsoft-graph-explorer-v4#2174

@millicentachieng
Copy link
Member

This is also affecting PowerShell module - microsoftgraph/msgraph-sdk-powershell#1577 (review).

How is the alternate key (appId) supposed to be used in the context of OAS 3? There is no direct equivalent of OData's AlternateKeys term in OAS 3 that I can think of. Aliasing of parameters is still an open feature request for OAS - OAI/OpenAPI-Specification#2298.

@peombwa The idea is to generate paths that utilize alternate parameters e.g. for the alternate key appId, the path will be /applications(appId={appId}).

I'm closing this issue since removing support for alternate keys fixed this issue. Let's have further discussions here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:p1 High priority but not blocking. Causes major but not critical loss of functionality SLA <=7days type:bug A broken experience
Projects
None yet
Development

No branches or pull requests

4 participants