You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
This is similar issue as #5808 where the contract we received has oneOf hierarchies where there is only a single ref under oneOf but the schema had type: object set. If the type: object is set, the contract does not generate the expected models.
Expected behavior
Kiota generates code for both schemas, with or without type: object.
# ... rest of the schema ...# Does not work (Component1) is not generated at all or mentioned in the# generated ExampleWithSingleOneOfWithTypeObject type.ExampleWithSingleOneOfWithTypeObject:
# Removing this workstype: objectoneOf:
- $ref: "#/components/schemas/Component1"discriminator:
propertyName: objectType# Does work (Component2) e.g. Component2 is used in place of ExampleWithSingleOneOfWithoutTypeObjectExampleWithSingleOneOfWithoutTypeObject:
oneOf:
- $ref: "#/components/schemas/Component2"discriminator:
propertyName: objectType# ... rest of the schema ...
How to reproduce
I have a repository with the generated client and example schema which reproduce the issue available:
Latest Kiota version known to work for scenario above?(Not required)
No response
Known Workarounds
No response
Configuration
OS: Windows 11
Architecture: x64
Debug output
Click to expand log
info: Kiota.Builder.KiotaBuilder[0]
Cleaning output directory _root_\kiota-type-object-one-of-issue\.\Generated\Hierarchy\CSharp
dbug: Kiota.Builder.KiotaBuilder[0]
kiota version 1.21.0
info: Kiota.Builder.KiotaBuilder[0]
loaded description from local source
dbug: Kiota.Builder.KiotaBuilder[0]
step 1 - reading the stream - took 00:00:00.0052293
dbug: Kiota.Builder.KiotaBuilder[0]
step 2 - parsing the document - took 00:00:00.0687352
dbug: Kiota.Builder.KiotaBuilder[0]
step 3 - updating generation configuration from kiota extension - took 00:00:00.0000606
dbug: Kiota.Builder.KiotaBuilder[0]
step 4 - filtering API paths with patterns - took 00:00:00.0032164
info: Kiota.Builder.KiotaBuilder[0]
Client root URL set to https://mytodos.doesnotexist
dbug: Kiota.Builder.KiotaBuilder[0]
step 5 - checking whether the output should be updated - took 00:00:00.0077425
dbug: Kiota.Builder.KiotaBuilder[0]
step 6 - create uri space - took 00:00:00.0023395
dbug: Kiota.Builder.KiotaBuilder[0]
InitializeInheritanceIndex 00:00:00.0023997
dbug: Kiota.Builder.KiotaBuilder[0]
CreateRequestBuilderClass 00:00:00
dbug: Kiota.Builder.KiotaBuilder[0]
MapTypeDefinitions 00:00:00.0034072
info: Kiota.Builder.KiotaBuilder[0]
Removing unused model Component1 as it is not referenced by the client API surface
dbug: Kiota.Builder.KiotaBuilder[0]
TrimInheritedModels 00:00:00
dbug: Kiota.Builder.KiotaBuilder[0]
CleanUpInternalState 00:00:00
dbug: Kiota.Builder.KiotaBuilder[0]
step 7 - create source model - took 00:00:00.0470989
dbug: Kiota.Builder.KiotaBuilder[0]
14ms: Language refinement applied
dbug: Kiota.Builder.KiotaBuilder[0]
step 8 - refine by language - took 00:00:00.0149214
dbug: Kiota.Builder.KiotaBuilder[0]
step 9 - writing files - took 00:00:00.0197369
info: Kiota.Builder.KiotaBuilder[0]
loaded description from local source
dbug: Kiota.Builder.KiotaBuilder[0]
step 10 - writing lock file - took 00:00:00.0085050
Generation completed successfully
Client base url set to https://mytodos.doesnotexist
dbug: Kiota.Builder.KiotaBuilder[0]
Api manifest path: _root_\kiota-type-object-one-of-issue\apimanifest.json
Hint: use the info command to get the list of dependencies you need to add to your project.
Example: kiota info -d "_root_\kiota-type-object-one-of-issue\.\DiscriminatorProblemSampleHierarchy.yaml" -l CSharp
Hint: use the --include-path and --exclude-path options with glob patterns to filter the paths generated.
Example: kiota generate --include-path "**/foo" -d "_root_\kiota-type-object-one-of-issue\.\DiscriminatorProblemSampleHierarchy.yaml"
Other information
Continuation of issue #5808 which was fixed by #5827.
The text was updated successfully, but these errors were encountered:
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
This is similar issue as #5808 where the contract we received has
oneOf
hierarchies where there is only a single ref underoneOf
but the schema had type: object set. If the type: object is set, the contract does not generate the expected models.Expected behavior
Kiota generates code for both schemas, with or without
type: object
.How to reproduce
I have a repository with the generated client and example schema which reproduce the issue available:
Open API description file
https://github.com/vipentti/kiota-type-object-one-of-issue/blob/main/DiscriminatorProblemSampleHierarchy.yaml
Kiota Version
1.21.0+ec3a3fff9fc6e2fb7de190d37969fa2e93aefdf5
Latest Kiota version known to work for scenario above?(Not required)
No response
Known Workarounds
No response
Configuration
Debug output
Click to expand log
Other information
Continuation of issue #5808 which was fixed by #5827.
The text was updated successfully, but these errors were encountered: