Skip to content

required is missing on path parameters #297

Closed

Description

@baywet

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.

Activity

  1. added
    type:bugA broken experience
    priority:p1High priority but not blocking. Causes major but not critical loss of functionality SLA <=7days
    on Oct 18, 2022
  2. baywet commented on Oct 18, 2022

    @baywet
    MemberAuthor

    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 Millicent Achieng (@millicentachieng)

  3. peombwa commented on Oct 19, 2022

    @peombwa
    Contributor

    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.

  4. irvinesunday commented on Oct 21, 2022

    @irvinesunday
    Contributor

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

  5. millicentachieng commented on Nov 10, 2022

    @millicentachieng
    Contributor

    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.

    Peter Ombwa (@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

Metadata

Metadata

Labels

priority:p1High priority but not blocking. Causes major but not critical loss of functionality SLA <=7daystype:bugA broken experience

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions