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

Kiota plugin should not generate function for API with request body contains nested object #5287

Closed
SLdragon opened this issue Sep 2, 2024 · 1 comment
Labels
status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience

Comments

@SLdragon
Copy link

SLdragon commented Sep 2, 2024

What are you generating using Kiota, clients or plugins?

Kiota plugin

In what context or format are you using Kiota?

Windows executable

Client library/SDK language

None

Describe the bug

From API plugin schema document, Function parameters should not contains nested object: https://spec-hub.azurewebsites.net/specifications/PluginManifest-2.1.html#type-0

So when generate API plugin file, Kiota should remove these APIs.

Example yaml file that contains nested object in request body:

openapi: 3.0.1
info:
  title: Swagger Petstore - OpenAPI 3.0 - Subset
  description: "This is a sample Pet Store Server based on the OpenAPI 3.0 specification. "
  termsOfService: http://swagger.io/terms/
  contact:
    email: [email protected]
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: 1.0.11
servers:
  - url: https://petstore3.swagger.io/api/v3
paths:
  /pet:
    post:
      tags:
        - pet
      summary: Add a new pet to the store
      description: Add a new pet to the store
      operationId: addPet
      requestBody:
        description: Create a new pet in the store
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Pet'
          application/xml:
            schema:
              $ref: '#/components/schemas/Pet'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/Pet'
        required: true
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Pet'
            application/xml:
              schema:
                $ref: '#/components/schemas/Pet'
        '400':
          description: Invalid input
        '422':
          description: Validation exception
components:
  schemas:
    Pet:
      required:
        - name
        - photoUrls
      type: object
      properties:
        id:
          type: integer
          format: int64
          example: 10
        name:
          type: string
          example: doggie
        category:
          $ref: '#/components/schemas/Category'
        photoUrls:
          type: array
          items:
            type: string
            xml:
              name: photoUrl
          xml:
            wrapped: true
        tags:
          type: array
          items:
            $ref: '#/components/schemas/Tag'
          xml:
            wrapped: true
        status:
          enum:
            - available
            - pending
            - sold
          type: string
          description: pet status in the store
      xml:
        name: pet
    Category:
      type: object
      properties:
        id:
          type: integer
          format: int64
          example: 1
        name:
          type: string
          example: Dogs
      xml:
        name: category
    Tag:
      type: object
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string
      xml:
        name: tag

Expected behavior

Should not generate function in ai-plugin.json file if API contains nested object

How to reproduce

Open API description file

https://raw.githubusercontent.com/SLdragon/example-openapi-spec/main/request-body-contains-nested-obj.yaml

Kiota Version

1.18.24082901

Latest Kiota version known to work for scenario above?(Not required)

No response

Known Workarounds

No response

Configuration

No response

Debug output

Click to expand log ```
</details>


### Other information

_No response_
@SLdragon SLdragon added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Sep 2, 2024
@github-project-automation github-project-automation bot moved this to Needs Triage 🔍 in Kiota Sep 2, 2024
@maisarissi
Copy link
Contributor

Duplicated of: https://github.com/microsoft/Microsoft.Plugins.Manifest/issues/255

This is being tracked as part of #5162 and will be available in 1.18.

@github-project-automation github-project-automation bot moved this from Needs Triage 🔍 to Done ✔️ in Kiota Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience
Projects
Archived in project
Development

No branches or pull requests

2 participants