Skip to content

Questions re: anyOf/allOf/oneOf, and one more thing #534

Open
@edonv

Description

@edonv

Question

I'm sure there are details I'm unaware of that impact these things, so forgive me if this has been discussed before. I have a few questions/thoughts regarding anyOf/allOf/oneOf:

  • Could oneOf be translated to an enum with associated values of the possible options?

  • For anyOf/oneOf where the only options are "null" and some $ref, could it be translated to an optional instance of that type? Because as of now, it's this:

struct itemPayload: Codable, Hashable, Sendable {
    var value1: OpenAPIRuntime.OpenAPIValueContainer?
    var value2: Components.Schemas.NamedAPIResource?
}

from this:

"item": {    
    "anyOf": [
        {
            "type": "null"
        },
        {
            "$ref": "./NamedAPIResource.json"
        }
    ]
}

when it would ideally just be:

typealias itemPayload: Components.Schemas.NamedAPIResource?

Separately, is it possible to set the configuration so the generated types from components/schemas are public, but the initializers and underlying stuff is internal? Or would I just have to do 2 separate targets that generate the types and clients separately, then I combine them for public-facing stuff in a 3rd target?

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/enhancementImprovements to existing feature.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions