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

Support mixed schemas of type: object + allOf/oneOf/anyOf #689

Open
knardi opened this issue Dec 5, 2024 · 0 comments
Open

Support mixed schemas of type: object + allOf/oneOf/anyOf #689

knardi opened this issue Dec 5, 2024 · 0 comments
Labels
kind/enhacement Improvements to existing feature.
Milestone

Comments

@knardi
Copy link

knardi commented Dec 5, 2024

Description

The GitHub API spec has something like this for the request body of the checks/create operation:

type: object
properties:
  name: ...
  head_sha: ...
  details_url: ...
  external_id: ...
  status: ...
  started_at: ...
  conclusion: ...
  completed_at: ...
  output: ...
  actions: ...
required:
- name
- head_sha
oneOf:
- properties:
    status:
      enum:
      - completed
  required:
  - status
  - conclusion
  additionalProperties: true
- properties:
    status:
      enum:
      - queued
      - in_progress
  additionalProperties: true

But when Swift OpenAPI Generator generates this request body, it only creates the status property from the oneOf section, and none of the other properties from the properties section.

Reproduction

openapi.yaml:
https://github.com/github/rest-api-description/blob/main/descriptions/ghes-3.5/ghes-3.5.yaml

openapi-generator-config.yaml:

generate:
    - types
    - client
accessModifier: public
filter:
    tags:
        - apps
        - checks

Package version(s)

.
├── swift-openapi-generator<https://github.com/apple/[email protected]>
│   ├── swift-algorithms<https://github.com/apple/[email protected]>
│   │   └── swift-numerics<https://github.com/apple/[email protected]>
│   ├── swift-collections<https://github.com/apple/[email protected]>
│   ├── openapikit<https://github.com/mattpolzin/[email protected]>
│   │   └── yams<https://github.com/jpsim/[email protected]>
│   ├── yams<https://github.com/jpsim/[email protected]>
│   └── swift-argument-parser<https://github.com/apple/[email protected]>
├── swift-openapi-runtime<https://github.com/apple/[email protected]>
│   └── swift-http-types<https://github.com/apple/[email protected]>
├── swift-openapi-urlsession<https://github.com/apple/[email protected]>
│   ├── swift-openapi-runtime<https://github.com/apple/[email protected]>
│   │   └── swift-http-types<https://github.com/apple/[email protected]>
│   ├── swift-http-types<https://github.com/apple/[email protected]>
│   └── swift-collections<https://github.com/apple/[email protected]>
├── swift-argument-parser<https://github.com/apple/[email protected]>
├── hummingbird<https://github.com/hummingbird-project/[email protected]>
│   ├── swift-async-algorithms<https://github.com/apple/[email protected]>
│   │   └── swift-collections<https://github.com/apple/[email protected]>
│   ├── swift-atomics<https://github.com/apple/[email protected]>
│   ├── swift-collections<https://github.com/apple/[email protected]>
│   ├── swift-log<https://github.com/apple/[email protected]>
│   ├── swift-http-types<https://github.com/apple/[email protected]>
│   ├── swift-metrics<https://github.com/apple/[email protected]>
│   ├── swift-distributed-tracing<https://github.com/apple/[email protected]>
│   │   └── swift-service-context<https://github.com/apple/[email protected]>
│   ├── swift-nio<https://github.com/apple/[email protected]>
│   │   ├── swift-atomics<https://github.com/apple/[email protected]>
│   │   ├── swift-collections<https://github.com/apple/[email protected]>
│   │   └── swift-system<https://github.com/apple/[email protected]>
│   ├── swift-nio-extras<https://github.com/apple/[email protected]>
│   │   ├── swift-nio<https://github.com/apple/[email protected]>
│   │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
│   │   │   ├── swift-collections<https://github.com/apple/[email protected]>
│   │   │   └── swift-system<https://github.com/apple/[email protected]>
│   │   ├── swift-nio-http2<https://github.com/apple/[email protected]>
│   │   │   ├── swift-nio<https://github.com/apple/[email protected]>
│   │   │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
│   │   │   │   ├── swift-collections<https://github.com/apple/[email protected]>
│   │   │   │   └── swift-system<https://github.com/apple/[email protected]>
│   │   │   └── swift-atomics<https://github.com/apple/[email protected]>
│   │   └── swift-http-types<https://github.com/apple/[email protected]>
│   ├── swift-nio-http2<https://github.com/apple/[email protected]>
│   │   ├── swift-nio<https://github.com/apple/[email protected]>
│   │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
│   │   │   ├── swift-collections<https://github.com/apple/[email protected]>
│   │   │   └── swift-system<https://github.com/apple/[email protected]>
│   │   └── swift-atomics<https://github.com/apple/[email protected]>
│   ├── swift-nio-ssl<https://github.com/apple/[email protected]>
│   │   └── swift-nio<https://github.com/apple/[email protected]>
│   │       ├── swift-atomics<https://github.com/apple/[email protected]>
│   │       ├── swift-collections<https://github.com/apple/[email protected]>
│   │       └── swift-system<https://github.com/apple/[email protected]>
│   ├── swift-nio-transport-services<https://github.com/apple/[email protected]>
│   │   ├── swift-nio<https://github.com/apple/[email protected]>
│   │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
│   │   │   ├── swift-collections<https://github.com/apple/[email protected]>
│   │   │   └── swift-system<https://github.com/apple/[email protected]>
│   │   └── swift-atomics<https://github.com/apple/[email protected]>
│   ├── swift-service-lifecycle<https://github.com/swift-server/[email protected]>
│   │   ├── swift-log<https://github.com/apple/[email protected]>
│   │   └── swift-async-algorithms<https://github.com/apple/[email protected]>
│   │       └── swift-collections<https://github.com/apple/[email protected]>
│   └── async-http-client<https://github.com/swift-server/[email protected]>
│       ├── swift-nio<https://github.com/apple/[email protected]>
│       │   ├── swift-atomics<https://github.com/apple/[email protected]>
│       │   ├── swift-collections<https://github.com/apple/[email protected]>
│       │   └── swift-system<https://github.com/apple/[email protected]>
│       ├── swift-nio-ssl<https://github.com/apple/[email protected]>
│       │   └── swift-nio<https://github.com/apple/[email protected]>
│       │       ├── swift-atomics<https://github.com/apple/[email protected]>
│       │       ├── swift-collections<https://github.com/apple/[email protected]>
│       │       └── swift-system<https://github.com/apple/[email protected]>
│       ├── swift-nio-http2<https://github.com/apple/[email protected]>
│       │   ├── swift-nio<https://github.com/apple/[email protected]>
│       │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
│       │   │   ├── swift-collections<https://github.com/apple/[email protected]>
│       │   │   └── swift-system<https://github.com/apple/[email protected]>
│       │   └── swift-atomics<https://github.com/apple/[email protected]>
│       ├── swift-nio-extras<https://github.com/apple/[email protected]>
│       │   ├── swift-nio<https://github.com/apple/[email protected]>
│       │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
│       │   │   ├── swift-collections<https://github.com/apple/[email protected]>
│       │   │   └── swift-system<https://github.com/apple/[email protected]>
│       │   ├── swift-nio-http2<https://github.com/apple/[email protected]>
│       │   │   ├── swift-nio<https://github.com/apple/[email protected]>
│       │   │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
│       │   │   │   ├── swift-collections<https://github.com/apple/[email protected]>
│       │   │   │   └── swift-system<https://github.com/apple/[email protected]>
│       │   │   └── swift-atomics<https://github.com/apple/[email protected]>
│       │   └── swift-http-types<https://github.com/apple/[email protected]>
│       ├── swift-nio-transport-services<https://github.com/apple/[email protected]>
│       │   ├── swift-nio<https://github.com/apple/[email protected]>
│       │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
│       │   │   ├── swift-collections<https://github.com/apple/[email protected]>
│       │   │   └── swift-system<https://github.com/apple/[email protected]>
│       │   └── swift-atomics<https://github.com/apple/[email protected]>
│       ├── swift-log<https://github.com/apple/[email protected]>
│       ├── swift-atomics<https://github.com/apple/[email protected]>
│       └── swift-algorithms<https://github.com/apple/[email protected]>
│           └── swift-numerics<https://github.com/apple/[email protected]>
├── swift-openapi-hummingbird<https://github.com/swift-server/[email protected]>
│   ├── swift-openapi-runtime<https://github.com/apple/[email protected]>
│   │   └── swift-http-types<https://github.com/apple/[email protected]>
│   └── hummingbird<https://github.com/hummingbird-project/[email protected]>
│       ├── swift-async-algorithms<https://github.com/apple/[email protected]>
│       │   └── swift-collections<https://github.com/apple/[email protected]>
│       ├── swift-atomics<https://github.com/apple/[email protected]>
│       ├── swift-collections<https://github.com/apple/[email protected]>
│       ├── swift-log<https://github.com/apple/[email protected]>
│       ├── swift-http-types<https://github.com/apple/[email protected]>
│       ├── swift-metrics<https://github.com/apple/[email protected]>
│       ├── swift-distributed-tracing<https://github.com/apple/[email protected]>
│       │   └── swift-service-context<https://github.com/apple/[email protected]>
│       ├── swift-nio<https://github.com/apple/[email protected]>
│       │   ├── swift-atomics<https://github.com/apple/[email protected]>
│       │   ├── swift-collections<https://github.com/apple/[email protected]>
│       │   └── swift-system<https://github.com/apple/[email protected]>
│       ├── swift-nio-extras<https://github.com/apple/[email protected]>
│       │   ├── swift-nio<https://github.com/apple/[email protected]>
│       │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
│       │   │   ├── swift-collections<https://github.com/apple/[email protected]>
│       │   │   └── swift-system<https://github.com/apple/[email protected]>
│       │   ├── swift-nio-http2<https://github.com/apple/[email protected]>
│       │   │   ├── swift-nio<https://github.com/apple/[email protected]>
│       │   │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
│       │   │   │   ├── swift-collections<https://github.com/apple/[email protected]>
│       │   │   │   └── swift-system<https://github.com/apple/[email protected]>
│       │   │   └── swift-atomics<https://github.com/apple/[email protected]>
│       │   └── swift-http-types<https://github.com/apple/[email protected]>
│       ├── swift-nio-http2<https://github.com/apple/[email protected]>
│       │   ├── swift-nio<https://github.com/apple/[email protected]>
│       │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
│       │   │   ├── swift-collections<https://github.com/apple/[email protected]>
│       │   │   └── swift-system<https://github.com/apple/[email protected]>
│       │   └── swift-atomics<https://github.com/apple/[email protected]>
│       ├── swift-nio-ssl<https://github.com/apple/[email protected]>
│       │   └── swift-nio<https://github.com/apple/[email protected]>
│       │       ├── swift-atomics<https://github.com/apple/[email protected]>
│       │       ├── swift-collections<https://github.com/apple/[email protected]>
│       │       └── swift-system<https://github.com/apple/[email protected]>
│       ├── swift-nio-transport-services<https://github.com/apple/[email protected]>
│       │   ├── swift-nio<https://github.com/apple/[email protected]>
│       │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
│       │   │   ├── swift-collections<https://github.com/apple/[email protected]>
│       │   │   └── swift-system<https://github.com/apple/[email protected]>
│       │   └── swift-atomics<https://github.com/apple/[email protected]>
│       ├── swift-service-lifecycle<https://github.com/swift-server/[email protected]>
│       │   ├── swift-log<https://github.com/apple/[email protected]>
│       │   └── swift-async-algorithms<https://github.com/apple/[email protected]>
│       │       └── swift-collections<https://github.com/apple/[email protected]>
│       └── async-http-client<https://github.com/swift-server/[email protected]>
│           ├── swift-nio<https://github.com/apple/[email protected]>
│           │   ├── swift-atomics<https://github.com/apple/[email protected]>
│           │   ├── swift-collections<https://github.com/apple/[email protected]>
│           │   └── swift-system<https://github.com/apple/[email protected]>
│           ├── swift-nio-ssl<https://github.com/apple/[email protected]>
│           │   └── swift-nio<https://github.com/apple/[email protected]>
│           │       ├── swift-atomics<https://github.com/apple/[email protected]>
│           │       ├── swift-collections<https://github.com/apple/[email protected]>
│           │       └── swift-system<https://github.com/apple/[email protected]>
│           ├── swift-nio-http2<https://github.com/apple/[email protected]>
│           │   ├── swift-nio<https://github.com/apple/[email protected]>
│           │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
│           │   │   ├── swift-collections<https://github.com/apple/[email protected]>
│           │   │   └── swift-system<https://github.com/apple/[email protected]>
│           │   └── swift-atomics<https://github.com/apple/[email protected]>
│           ├── swift-nio-extras<https://github.com/apple/[email protected]>
│           │   ├── swift-nio<https://github.com/apple/[email protected]>
│           │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
│           │   │   ├── swift-collections<https://github.com/apple/[email protected]>
│           │   │   └── swift-system<https://github.com/apple/[email protected]>
│           │   ├── swift-nio-http2<https://github.com/apple/[email protected]>
│           │   │   ├── swift-nio<https://github.com/apple/[email protected]>
│           │   │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
│           │   │   │   ├── swift-collections<https://github.com/apple/[email protected]>
│           │   │   │   └── swift-system<https://github.com/apple/[email protected]>
│           │   │   └── swift-atomics<https://github.com/apple/[email protected]>
│           │   └── swift-http-types<https://github.com/apple/[email protected]>
│           ├── swift-nio-transport-services<https://github.com/apple/[email protected]>
│           │   ├── swift-nio<https://github.com/apple/[email protected]>
│           │   │   ├── swift-atomics<https://github.com/apple/[email protected]>
│           │   │   ├── swift-collections<https://github.com/apple/[email protected]>
│           │   │   └── swift-system<https://github.com/apple/[email protected]>
│           │   └── swift-atomics<https://github.com/apple/[email protected]>
│           ├── swift-log<https://github.com/apple/[email protected]>
│           ├── swift-atomics<https://github.com/apple/[email protected]>
│           └── swift-algorithms<https://github.com/apple/[email protected]>
│               └── swift-numerics<https://github.com/apple/[email protected]>
└── jwt-kit<https://github.com/vapor/[email protected]>
    ├── swift-crypto<https://github.com/apple/[email protected]>
    │   └── swift-asn1<https://github.com/apple/[email protected]>
    ├── swift-certificates<https://github.com/apple/[email protected]>
    │   ├── swift-crypto<https://github.com/apple/[email protected]>
    │   │   └── swift-asn1<https://github.com/apple/[email protected]>
    │   └── swift-asn1<https://github.com/apple/[email protected]>
    └── swift-log<https://github.com/apple/[email protected]>

Expected behavior

Expected to see all of the properties for the requestBody in the Input (e.g. name, head_sha, details_url, etc.), but I only have an enum with two cases that contain status.

Environment

swift version: 6.0

Additional information

No response

@knardi knardi added kind/bug Feature doesn't work as expected. status/triage Collecting information required to triage the issue. labels Dec 5, 2024
@czechboy0 czechboy0 changed the title Incorrect generation of checks/create operation for GitHub API spec Support mixed schemas of type: object + allOf/oneOf/anyOf Dec 6, 2024
@czechboy0 czechboy0 added kind/enhacement Improvements to existing feature. and removed kind/bug Feature doesn't work as expected. status/triage Collecting information required to triage the issue. labels Dec 6, 2024
@czechboy0 czechboy0 added this to the Post-1.0 milestone Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhacement Improvements to existing feature.
Projects
None yet
Development

No branches or pull requests

2 participants