Skip to content

proposal: jsonschema: marshal bool-equivalent schemas as bools #244

@jba

Description

@jba

Marshal the empty schema as true and the negation of the empty schema as false.

We should be able to do this unconditionally, since they are equivalent. And it will fix #230.

If we needed to make it conditional, We could add a MarshalAsBool global function, or add it as a method on Schema. Would the global suffice? Perhaps not, if the same process talked to two different systems which each required a different setting.

Perhaps a better idea, though more clumsy, is to add an Encoder type, which could then be configured as needed. That would be the best way to handle the case of two incompatible systems. That will be familiar to users of encoding/json.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions