Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No empty arrays in "required" field in Schema Object #161

Merged
merged 2 commits into from
Nov 15, 2019

Conversation

road21
Copy link

@road21 road21 commented Nov 6, 2019

According to validation in https://github.com/OAI/OpenAPI-Specification/blob/master/schemas/v3.0/schema.json

"required": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "minItems": 1,
          "uniqueItems": true
        }


JsonObject.fromIterable(
"type" -> Json.fromString("object") ::
required.value.toNev.map("required" -> _.asJson).toList
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could it be just

"required" -> required.value.toNev.fold(Json.Null)(_.asJson)

?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, since we already are putting nulls for Skippable values.

@Odomontois Odomontois added this to the 0.11.1 milestone Nov 15, 2019
@Odomontois Odomontois merged commit 20e9e6a into tofu-tf:master Nov 15, 2019
@Odomontois Odomontois added the fix label Dec 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants