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

Error: The type does not contain any information #5701

Open
MortenTobiasNielsen opened this issue Oct 31, 2024 · 2 comments
Open

Error: The type does not contain any information #5701

MortenTobiasNielsen opened this issue Oct 31, 2024 · 2 comments
Labels
generator Issues or improvements relater to generation capabilities. type:bug A broken experience type:investigation Investigation work, output should be a document detailing findings or a prototype

Comments

@MortenTobiasNielsen
Copy link

MortenTobiasNielsen commented Oct 31, 2024

What are you generating using Kiota, clients or plugins?

API Client/SDK

In what context or format are you using Kiota?

Nuget tool

Client library/SDK language

Csharp

Describe the bug

When I try to generate an SDK I get this error:
2024-10-31 14:29:34.644 [error] error generating the client: One or more errors occurred. (One or more errors occurred. (The type does not contain any information Path: \orders\v1, Reference Id: UserId))

Image

Expected behavior

That I didn't get the error and the SDK was generated.

How to reproduce

Create a .yaml file and insert the example below. Use Kiota to generate an SDK. In this simple example it doesn't make sense to have multi nesting references, but the company I work for has a pretty complex API where something like this makes more sense.

This fails:

openapi: 3.0.3
info:
  title: Simple API
  description: A simple API to demonstrate OpenAPI 3.0.3
  version: 1.0.0
  x-bundled: true
  contact:
    name: API Support
    url: 'http://www.example.com/support'
servers:
  - url: https://api.example.com/v1
tags:
  - name: orders
    description: Operations about orders
paths:
  /orders/v1:
    get:
      summary: List all orders
      operationId: orders
      description: Returns a list of orders.
      tags:
        - orders
      responses:
        '200':
          description: A list of orders
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Order'
components:
  schemas:
    Order:
      title: Order
      description: Object representing an Order.
      type: object
      properties:
        TraderId:
          $ref: '#/components/schemas/TraderId'
    TraderId:
      title: Trader Id
      description: >-
        The ID of the authorized dealer who placed the trade. If the application
        uses a system user, this will be the user responsible for overseeing the
        application.
      allOf:
        - $ref: '#/components/schemas/UserId'
    UserId:
      title: User Id
      description: Unique identifier of a User.
      type: string
      pattern: ^[1-9][0-9]*$
      example: '16371609'

This works:

openapi: 3.0.3
info:
  title: Simple API
  description: A simple API to demonstrate OpenAPI 3.0.3
  version: 1.0.0
  x-bundled: true
  contact:
    name: API Support
    url: 'http://www.example.com/support'
servers:
  - url: https://api.example.com/v1
tags:
  - name: orders
    description: Operations about orders
paths:
  /orders/v1:
    get:
      summary: List all orders
      operationId: orders
      description: Returns a list of orders.
      tags:
        - orders
      responses:
        '200':
          description: A list of orders
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Order'
components:
  schemas:
    Order:
      title: Order
      description: Object representing an Order.
      type: object
      properties:
        TraderId:
          $ref: '#/components/schemas/TraderId'
    TraderId:
      title: Trader Id
      description: >-
        The ID of the authorized dealer who placed the trade. If the application
        uses a system user, this will be the user responsible for overseeing the
        application.
      type: string
      pattern: ^[1-9][0-9]*$
      example: '16371609'

Open API description file

No response

Kiota Version

1.19.1

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_
@MortenTobiasNielsen MortenTobiasNielsen added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Oct 31, 2024
@github-project-automation github-project-automation bot moved this to Needs Triage 🔍 in Kiota Oct 31, 2024
@msgraph-bot msgraph-bot bot added the Csharp Pull requests that update .net code label Oct 31, 2024
@andrueastman
Copy link
Member

Thanks for raising this @MortenTobiasNielsen

This will need some investigation as this error is thrown at

throw new InvalidOperationException($"The type does not contain any information Path: {currentNode.Path}, Reference Id: {referenceId}"),

At this point, the builder seems to expect that the AllOf structure means that there is inheritance involved but the final reference to '#/components/schemas/UserId' would end up to a primitive/string type. To fix this I suspect that we would need to look further into the evaluation of inheritance at

if (schema.IsInherited())

@andrueastman andrueastman added type:investigation Investigation work, output should be a document detailing findings or a prototype generator Issues or improvements relater to generation capabilities. and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned Csharp Pull requests that update .net code labels Nov 6, 2024
@MortenTobiasNielsen
Copy link
Author

Good to hear that you have an idea of where the problem might originate, I hope it won't be too problematic to find the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
generator Issues or improvements relater to generation capabilities. type:bug A broken experience type:investigation Investigation work, output should be a document detailing findings or a prototype
Projects
Status: Needs Triage 🔍
Development

No branches or pull requests

2 participants