OpenAPI: add required section for the non-nullable columns (#1148)
This commit is contained in:
committed by
Steve Chávez
parent
fa1e92fdf2
commit
2b46afe1ec
@@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
- #1099, Add support for getting json/jsonb by array index - @steve-chavez
|
- #1099, Add support for getting json/jsonb by array index - @steve-chavez
|
||||||
- #1145, Add materialized view columns to OpenAPI output - @steve-chavez
|
- #1145, Add materialized view columns to OpenAPI output - @steve-chavez
|
||||||
- #709, Allow embedding on views with subselects/CTE - @steve-chavez
|
- #709, Allow embedding on views with subselects/CTE - @steve-chavez
|
||||||
|
- #1148, OpenAPI: add `required` section for the non-nullable columns - @laughedelic
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ makeTableDef pks (t, cs, _) =
|
|||||||
(tn, (mempty :: Schema)
|
(tn, (mempty :: Schema)
|
||||||
& description .~ tableDescription t
|
& description .~ tableDescription t
|
||||||
& type_ .~ SwaggerObject
|
& type_ .~ SwaggerObject
|
||||||
& properties .~ fromList (map (makeProperty pks) cs))
|
& properties .~ fromList (map (makeProperty pks) cs)
|
||||||
|
& required .~ map colName (filter (not . colNullable) cs))
|
||||||
|
|
||||||
makeProperty :: [PrimaryKey] -> Column -> (Text, Referenced Schema)
|
makeProperty :: [PrimaryKey] -> Column -> (Text, Referenced Schema)
|
||||||
makeProperty pks c = (colName c, Inline s)
|
makeProperty pks c = (colName c, Inline s)
|
||||||
|
|||||||
@@ -113,7 +113,10 @@ spec = do
|
|||||||
"format": "integer",
|
"format": "integer",
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"required": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|]
|
|]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user