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

The GetSchemaTitles functions returns no options when no allOf, anyOf, oneOf children have titles. #1270

Closed
Tracked by #1266
darrelmiller opened this issue Feb 27, 2022 · 1 comment · Fixed by #1381
Assignees
Labels
fixed generator Issues or improvements relater to generation capabilities. type:bug A broken experience

Comments

@darrelmiller
Copy link
Member

darrelmiller commented Feb 27, 2022

See this code:

else if(schema.AnyOf.Any()) return schema.AnyOf.SelectMany(x => x.GetNonEmptySchemas());

Generation fails with an OpenAPI description like the following,

  '/unionType':
    get:
      responses:
        '200':
          description: A response with two or more distinct types 
          content:
            'application/json':
              schema:
                oneOf:
                - $ref: "#/components/schemas/simpleObject"
                - { type: number }
      x-csharp: Task<GetUnionTypeResponse> GetAsync(...);  

We need to fallback to something like UnionTypeResponse as a classname. When declarationName is empty, the generation fails with an ugly error.

image

@baywet baywet self-assigned this Feb 28, 2022
@baywet baywet added the type:bug A broken experience label Feb 28, 2022
@baywet baywet added this to Kiota Feb 28, 2022
@baywet baywet moved this to Todo in Kiota Feb 28, 2022
@baywet baywet added the generator Issues or improvements relater to generation capabilities. label Feb 28, 2022
@baywet
Copy link
Member

baywet commented Feb 28, 2022

related #835

@baywet baywet moved this from Todo to In Progress in Kiota Mar 14, 2022
@baywet baywet added the fixed label Mar 14, 2022
Repository owner moved this from In Progress to Done in Kiota Mar 16, 2022
baywet added a commit that referenced this issue Mar 16, 2022
- fixes #1270 a bug where missing schema title would make union types fail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed generator Issues or improvements relater to generation capabilities. type:bug A broken experience
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants