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

Some types missing default values for @odata.type #248

Closed
andrueastman opened this issue Jul 7, 2022 · 2 comments · Fixed by #256
Closed

Some types missing default values for @odata.type #248

andrueastman opened this issue Jul 7, 2022 · 2 comments · Fixed by #256
Assignees
Labels
priority:p2 Medium. Generally has a work-around and a smaller sub-set of customers is affected. SLA <=30 days type:bug A broken experience
Milestone

Comments

@andrueastman
Copy link
Member

Additionally, after some more thinking, could we also take that opportunity to set a default value for the odata.type property to the actual odata type? i.e. #microsoft.graph.entity.
This would enable kiota to initialize this property at runtime and send it to the service.

Originally posted by @baywet in #243 (comment)

@andrueastman
Copy link
Member Author

Taking a look at the latest generation the FileAttachment schema is missing the deafult value for @odata.type

    microsoft.graph.fileAttachment:
      allOf:
        - $ref: '#/components/schemas/microsoft.graph.attachment'
        - title: fileAttachment
          type: object
          properties:
            contentBytes:
              type: string
              description: The base64-encoded contents of the file.
              format: base64url
              nullable: true
            contentId:
              type: string
              description: The ID of the attachment in the Exchange store.
              nullable: true
            contentLocation:
              type: string
              description: Do not use this property as it is not supported.
              nullable: true
      x-ms-discriminator-value: '#microsoft.graph.fileAttachment'

Its base type Attachment however has the default value defined as '#microsoft.graph.attachment'

    microsoft.graph.attachment:
      allOf:
        - $ref: '#/components/schemas/microsoft.graph.entity'
        - title: attachment
          required:
            - '@odata.type'
          type: object
          properties:
            contentType:
              type: string
              description: The MIME type.
              nullable: true
            isInline:
              type: boolean
              description: 'true if the attachment is an inline attachment; otherwise, false.'
            lastModifiedDateTime:
              pattern: '^[0-9]{4,}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]{1,12})?(Z|[+-][0-9][0-9]:[0-9][0-9])$'
              type: string
              description: 'The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z'
              format: date-time
              nullable: true
            name:
              type: string
              description: The display name of the attachment. This does not need to be the actual file name.
              nullable: true
            size:
              maximum: 2147483647
              minimum: -2147483648
              type: integer
              description: The length of the attachment in bytes.
              format: int32
            '@odata.type':
              type: string
              default: '#microsoft.graph.attachment'

The adding of the default value seems to apply only if the schema has a discriminator defined. We would probably need this defined in the derived schema as well so that Kiota can initialize the property for type disambiguation in the API.

@baywet baywet added type:bug A broken experience priority:p2 Medium. Generally has a work-around and a smaller sub-set of customers is affected. SLA <=30 days labels Jul 7, 2022
@baywet baywet added this to the OData:1.0.11 milestone Jul 7, 2022
@baywet
Copy link
Member

baywet commented Jul 13, 2022

same problem with user for example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:p2 Medium. Generally has a work-around and a smaller sub-set of customers is affected. SLA <=30 days type:bug A broken experience
Projects
None yet
3 participants