-
Notifications
You must be signed in to change notification settings - Fork 216
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
Schema object allOf requires type #4074
Comments
Thanks for using kiota and for reaching out. We could add a validation rule that warns when a schema has properties, but its type isn't object. like this one This would prompt people to edit their description and add the missing type object. We could alliteratively/also change this evaluation rule to add am or condition branch which checks on the presence of properties. This might have side effects though. Additional unit tests would go here Is this something you'd be interested in submitting a pull request for? |
…type Signed-off-by: Vincent Biret <[email protected]>
…type Signed-off-by: Vincent Biret <[email protected]>
If a schema object uses
allOf
and includes an inline schema definition, but that inline definition doesn't specifytype
, then the inline definition is ignored (in java generation at least).Minimal example:
Steps to reproduce
Run command:
kiota generate --language java -n 'test'
Version:
1.10.1
(docker container mcr.microsoft.com/openapi/kiota)Expected behaviour
A class
test.OuterPayload
should be generated with fieldssomeField
andanotherField
and matching setter methods (noteanotherField
is in a superclass).Actual behaviour
Only
anotherField
appears;someField
is not generated.No errors or warnings are logged - the fields/methods are simply missing in the generated java code.
Workaround
In the inline schema definition, include
type: object
.Of course this is only possible if you are in control of the schema in use - so in most cases this workaround won't work.
Notes
I believe the above document is valid according to the OpenAPI spec. In all other situations, the
type
appears to default toobject
and it does not need to be specified explicitly. For example, ininnerPayload
in the example above,type: object
is not required. It appears only to be withinallOf
thattype: object
is required.The text was updated successfully, but these errors were encountered: