Skip to content

Commit ccd6cb7

Browse files
authored
fix: better property title (#2800)
1 parent 1dcb60a commit ccd6cb7

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

samtranslator/schema/sam.schema.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -2016,9 +2016,7 @@
20162016
"title": "OAuth2Authorizer",
20172017
"type": "object"
20182018
},
2019-
"PassThroughProp": {
2020-
"title": "PassThroughProp"
2021-
},
2019+
"PassThroughProp": {},
20222020
"PrimaryKey": {
20232021
"additionalProperties": false,
20242022
"properties": {

samtranslator/schema/schema.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -155547,9 +155547,7 @@
155547155547
],
155548155548
"type": "object"
155549155549
},
155550-
"PassThroughProp": {
155551-
"title": "PassThroughProp"
155552-
},
155550+
"PassThroughProp": {},
155553155551
"PrimaryKey": {
155554155552
"additionalProperties": false,
155555155553
"properties": {

samtranslator/schema/schema.py

+5
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ def get_schema(model: Type[pydantic.BaseModel]) -> Dict[str, Any]:
6969
# Validated in https://github.com/aws/serverless-application-model/blob/5c82f5d2ae95adabc9827398fba8ccfc3dbe101a/tests/schema/test_validate_schema.py#L91
7070
obj["$schema"] = "http://json-schema.org/draft-04/schema#"
7171

72+
# Pydantic automatically adds title to model (https://github.com/pydantic/pydantic/issues/1051),
73+
# and the YAML extension for VS Code then shows 'PassThroughProp' as title for pass-through
74+
# properties (instead of the title of the property itself)... so manually deleting it.
75+
del obj["definitions"]["PassThroughProp"]["title"]
76+
7277
return obj
7378

7479

0 commit comments

Comments
 (0)