Skip to content

[BUG]: Missing additionalProperties mapping #2684

Open
@dmipeck

Description

@dmipeck

Quicktype does not generate a field for additionalProperties in the output Go struct

Issue Type

Quicktype output

Context (Environment, Version, Language)

Input Format: JSON Schema
Output Language: Go

CLI, npm, or app.quicktype.io: CLI
Version: 23.0.171

Description

The devcontainer base schema uses additionalProperties for defining a set of devcontainer features. Without a field to read the map of additional properties it's not possible to implement the features spec without modifying the generated Go code or the original schema JSON.

Input Data

test.schema.json:

{
    "$schema": "https://json-schema.org/draft/2019-09/schema",
    "type": "object",
    "properties": {
        "deprecatedField": {
            "deprecated": true
        }
    },
    "additionalProperties": true
}

Expected Behaviour / Output

The generated struct contains fields for the deprecated field, plus some field for accessing additionalProperties, e.g:

type TestSchema struct {
        DeprecatedField interface{} `json:"deprecatedField"`
        AdditionalProperties map[string]interface{}
}

Current Behaviour / Output

Only the deprecated field is generated:

type TestSchema struct {
        DeprecatedField interface{} `json:"deprecatedField"`
}

Steps to Reproduce

run with the schema input above:

quicktype --lang go --src-lang schema --src ./test.schema.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions