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

derived class with additional data field are missing it #4224

Closed
baywet opened this issue Feb 23, 2024 · 1 comment · Fixed by #4368
Closed

derived class with additional data field are missing it #4224

baywet opened this issue Feb 23, 2024 · 1 comment · Fixed by #4368
Assignees
Labels
generator Issues or improvements relater to generation capabilities. help wanted Issue caused by core project dependency modules or library type:bug A broken experience
Milestone

Comments

@baywet
Copy link
Member

baywet commented Feb 23, 2024

The following yaml description results in the alert model missing the additional data field.
This is because it's conflicting with the additional data field the parent model gets from standard generation.

This method needs to have a special case to handle that, and when the custom property name is "additionalData" add a prefix like we do when some fields conflict with native language primitives

private CodeProperty? CreateProperty(string childIdentifier, string childType, OpenApiSchema? propertySchema = null, CodeTypeBase? existingType = null, CodePropertyKind kind = CodePropertyKind.Custom)

openapi: 3.0.1
info:
  title: OData Service for namespace microsoft.graph
  description: This OData service is located at https://graph.microsoft.com/v1.0
  version: v1.0
  x-ms-generated-by:
    toolName: Microsoft.OpenApi.OData
    toolVersion: 1.0.9.0
servers:
  - url: https://graph.microsoft.com/v1.0
paths:
  '/security/alerts_v2/{alert-id}':
    description: Provides operations to manage the alerts_v2 property of the microsoft.graph.security entity.
    get:
      tags:
        - security.alert
      summary: Get alert
      description: Get the properties and relationships of an alert object.
      externalDocs:
        description: Find more info here
        url: https://learn.microsoft.com/graph/api/security-alert-get?view=graph-rest-1.0
      operationId: security.GetAlerts_v2
      responses:
        2XX:
          description: Retrieved navigation property
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/microsoft.graph.security.alert'
      x-ms-docs-operation-type: operation
components:
    microsoft.graph.entity:
      title: entity
      required:
        - '@odata.type'
      type: object
      properties:
        id:
          type: string
          description: The unique identifier for an entity. Read-only.
        '@odata.type':
          type: string
    microsoft.graph.security.dictionary:
      title: dictionary
      required:
        - '@odata.type'
      type: object
      properties:
        '@odata.type':
          type: string
    microsoft.graph.security.alert:
      allOf:
        - $ref: '#/components/schemas/microsoft.graph.entity'
        - title: alert
          required:
            - '@odata.type'
          type: object
          properties:
            actorDisplayName:
              type: string
              description: The adversary or activity group that is associated with this alert.
              nullable: true
            additionalData:
              anyOf:
                - $ref: '#/components/schemas/microsoft.graph.security.dictionary'
                - type: object
                  nullable: true
@baywet baywet added type:bug A broken experience generator Issues or improvements relater to generation capabilities. labels Feb 23, 2024
@baywet baywet added this to the Kiota v1.13 milestone Feb 23, 2024
@baywet baywet added the help wanted Issue caused by core project dependency modules or library label Feb 26, 2024
@baywet
Copy link
Member Author

baywet commented Feb 26, 2024

Additionally, the unit test could be added here similar to this test but with the provided repro OpenAPI description.

This issue has originally been reported by @tiananguyen (MSFT) who's currently checking with her management how to proceed (they are blocked by the bug)

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. help wanted Issue caused by core project dependency modules or library type:bug A broken experience
Projects
Archived in project
1 participant