Skip to content

converter - import anyOf unixtime missed decorator #9163

@baywet

Description

@baywet

When importing this OpenAPI schema

components:
  schemas:
    FineTuningJob:
      type: object
      properties:
        created_at:
          type: integer
          description: The Unix timestamp (in seconds) for when the fine-tuning job was created.
          format: unixtime

I get the following result

@encode(DateTimeKnownEncoding.unixTimestamp, integer) created_at: utcDateTime

However, if the schema is instead an anyOf with null, I get the following TypeSpec result, which misses the encode decorator

components:
  schemas:
    FineTuningJob:
      type: object
      properties:
        finished_at:
          anyOf:
            - type: integer
              description: The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running.
              format: unixtime
            - type: "null"
finished_at: utcDateTime | null

The decorator should be present whenever a union type with null is emitted.

Metadata

Metadata

Assignees

Labels

openapi3:converterIssues for @typespec/openapi3 openapi to typespec converter

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions