-
Notifications
You must be signed in to change notification settings - Fork 214
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
allOf
- Properties not generated - C#
#4346
Comments
Hi @gadcam, |
@baywet Bonjour Vincent,
Then I suppose the problem might involve a more complex structure. Here is another example which I just copy pasted from the files and redacted
So not exactly the previous |
Thanks for the additional details here. Just to confirm, I double checked the Microsoft Graph OAI descriptions and here is the general pattern employed for over 2000 models: microsoft.graph.user:
allOf:
- $ref: '#/components/schemas/microsoft.graph.directoryObject'
- title: user
required:
- '@odata.type'
type: object
properties:
aboutMe:
type: string
description: A freeform text entry field for the user to describe themselves. Returned only on $select.
nullable: true Which maps to your broken example (except for the order, but hopefully it's not just an ordering thing, worth checking for sanity though) Tests would go here
Duplicating them to account for the additional scenarios that are currently not tested for would probably be a good first step and might outline something I'm not seeing by just looking at the provided descriptions. |
tested and looks like it's not an ordering thing, at least, in the absence of other edge cases kicking in ( e.g. #4325 ) |
Started looking into this with #4381 which I believe will fix this one as well, but I need to design a unit test for it. |
update: I did manage to fix this unrecognized inheritance case, and remove a bunch of dependencies on schema titles which we didn't want to begin with. |
I have been attempting to reduce this again, this is what I have: Common description: openapi: 3.0.3
servers:
- url: https://example.com
info:
title: example
version: 0.0.1
paths:
/path:
post:
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/ComponentList"
responses:
"201":
description: Created
content:
application/json:
schema:
type: string
components:
schemas:
Component:
type: object
properties:
prop:
type: string
ListMeta:
type: object
properties:
size:
type: number Adding the definition of Working: ComponentList:
type: object
properties:
items:
type: array
items:
$ref: "#/components/schemas/Component"
allOf:
- $ref: "#/components/schemas/ListMeta" and working as well: ComponentList:
type: object
allOf:
- $ref: "#/components/schemas/ListMeta"
- type: object
properties:
items:
type: array
items:
$ref: "#/components/schemas/Component" results in the expected: @dataclass
class ComponentList(ListMeta):
# The items property
items: Optional[List[Component]] = None unfortunately switching the order of the ComponentList:
type: object
allOf:
- type: object
properties:
items:
type: array
items:
$ref: "#/components/schemas/Component"
- $ref: "#/components/schemas/ListMeta" @dataclass
class ListMeta(ComponentList):
# The size property
size: Optional[float] = None it's 100% reproducible with kiota 1.12.0 and using a command like: kiota generate -l python -c PostsClient -n client -d list-issue.yaml -o tmp-list --clean-output --log-level Trace |
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. |
(just removed the tag so the bot leaves us alone on this one) Update: I have paused work on this because of other priorities at the moment, and I'll be out the next two weeks. |
Thanks for sharing openly your plans @baywet , I have found a few more edge cases and will try to report with minimal reproducers along. |
part of what might be making a difference, and looking at #4074 is the presence/absence of |
Hello,
In the case of an
allOf
if there areproperties
directly written in anobject
along side a$ref
theproperties
are not taken into account in the generated code.Moving up the
properties
outside theallOf
fix the issueSeems related to #4325 but not the same exact bug.
Here is an example to illustrate the bug
File 1 - Broken
File 2 - Working
The text was updated successfully, but these errors were encountered: