Skip to content

required key in LinkableEntities schema not matched in property map #1222

Open
@heckj

Description

@heckj

Description

I was trying to generate classes from the provided OpenAPI schema (LinkableEntities), and the generator highlighted that there's a property in the required list for a type that isn't listed in the schema for it.

The command I used to find this (repo):

git clone https://github.com/apple/swift-openapi-generator
cd swift-openapi-generator
swift run swift-openapi-generator generate --mode types --output-directory . ~/src/swift-project/swift-docc/Sources/SwiftDocC/SwiftDocC.docc/Resources/LinkableEntities.json --dry-run

The specific error message was:

warning: A property name only appears in the required list, but not in the properties map - this is likely a typo; skipping this property. [context: foundIn=Components.Schemas.TopicImage (#/components/schemas/TopicImage)/identifier]

Looking at the OpenAPI JSON:

"TopicImage": {
                "type": "object",
                "required": [
                    "type",
                    "identifier"
                ],
                "properties": {
                    "type": {
                        "type": "string",
                        "enum": ["icon", "card"]
                    },
                    "reference": {
                        "type": "string",
                        "format": "reference(ImageRenderReference)"
                    }
                }
            },

It looks like perhaps identifier was renamed to reference. Since this is a pretty new experimental feature, I wanted to check for correctness before submitting a pull request.

Checklist

  • If possible, I've reproduced the issue using the main branch of this package.
  • This issue hasn't been addressed in an existing GitHub issue.

Expected Behavior

No response

Actual behavior

No response

Steps To Reproduce

The command I used to find this (repo):

git clone https://github.com/apple/swift-openapi-generator
cd swift-openapi-generator
swift run swift-openapi-generator generate --mode types --output-directory . ~/src/swift-project/swift-docc/Sources/SwiftDocC/SwiftDocC.docc/Resources/LinkableEntities.json --dry-run

The specific error message was:

warning: A property name only appears in the required list, but not in the properties map - this is likely a typo; skipping this property. [context: foundIn=Components.Schemas.TopicImage (#/components/schemas/TopicImage)/identifier]

Swift-DocC Version Information

f47942a

Swift Compiler Version Information

Apple Swift version 6.1 (swift-6.1-RELEASE)
Target: arm64-apple-macosx15.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions