Skip to content

Nullary schema should render valid swagger code #167

@michalrus

Description

@michalrus

What we’re doing currently returns quite a few errors from the validator (and crashes swagger-codegen etc.):

nullarySchema :: Schema
nullarySchema = mempty
& type_ .~ SwaggerArray
& items ?~ SwaggerItemsArray []

{
  "items": [],
  "type": "array"
}

E.g. notice that "items" must be an object, and they’re an array above.

But this does not, and closely matches Aeson’s [] representation of () and mixed nullary/non-nullary constructors of a datatype:

{
  "type": "array",
  "items": {},
  "maxItems": 0,
  "example": []
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions