Skip to content

Non-primitive types not required #1511

@ShaunSHamilton

Description

@ShaunSHamilton

This appears to be a bug, but if not, then a work around be be appreciated:

posts: {
items: { $ref: '#/definitions/Post' },
type: 'array',
},

required: ['email', 'bytes', 'keywords', 'biography'],
},

Surely Posts should be a required field?

In my case, I have the following type:

/// An exam as designed by the examiners
model A {
  config             Config
}
{
  "definitions": {
    "A": {
      "type": "object",
      "properties": {
        "config": {
          "$ref": "#/definitions/B"
        }
      },
      "required": []
    },
    "B": {
      "type": "object",
      "properties": {
        "tags": {
          "type": "array",
          "originalType": "TagConfig",
          "items": {
            "$ref": "#/definitions/TagConfig"
          }
        },
        "total_time": {
          "type": "integer",
          "originalType": "Int",
        },
        "question_types": {
          "type": "array",
          "originalType": "QuestionConfig",
          "items": {
            "$ref": "#/definitions/QuestionConfig"
          }
        }
      },
      "required": [
        "total_time"
      ]
    }
  }
}

Same goes for TagConfig and QuestionConfig - they are required, but do not get treated as such.

I am happy to contribute a fix, if this is unintentional

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions