Skip to content

Commit

Permalink
Fix some OpenAPI examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mmwinther committed Dec 16, 2024
1 parent 613147d commit cbae8da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@
class CompleteResponse(BaseModel):
"""Complete response For internal users who need all details while maintaining variable definitions."""

id: StrictStr | None = Field(
default=None, description="Unique identifier for the variable definition."
)
id: StrictStr = Field(description="Unique identifier for the variable definition.")
patch_id: StrictInt = Field(
description="Integer identifying a patch of a variable definition."
)
Expand Down Expand Up @@ -187,11 +185,6 @@ def to_dict(self) -> dict[str, Any]:
# override the default output from pydantic by calling `to_dict()` of last_updated_by
if self.last_updated_by:
_dict["last_updated_by"] = self.last_updated_by.to_dict()
# set to None if id (nullable) is None
# and model_fields_set contains the field
if self.id is None and "id" in self.model_fields_set:
_dict["id"] = None

# set to None if classification_reference (nullable) is None
# and model_fields_set contains the field
if (
Expand Down
26 changes: 6 additions & 20 deletions tests/variable_definitions/resources/variable-definitions-0.1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ paths:
format: date
nullable: true
examples:
Date not specified:
value: ""
Specific date:
value: 1970-01-01
responses:
Expand Down Expand Up @@ -135,11 +133,9 @@ paths:
"contact": {
"title": "Seksjon for befolkningsstatistikk",
"email": "[email protected]"
}
,
},
"last_updated_at": "2024-06-12T10:39:41.038Z"
}
]
Date not specified:
value: "[]"
Expand Down Expand Up @@ -179,8 +175,6 @@ paths:
format: date
nullable: true
examples:
Date not specified:
value: ""
Specific date:
value: 1970-01-01
responses:
Expand Down Expand Up @@ -340,11 +334,9 @@ paths:
"contact": {
"title": "Seksjon for befolkningsstatistikk",
"email": "[email protected]"
}
,
},
"last_updated_at": "2024-06-12T10:39:41.038Z"
}
]
/vardok-migration/{vardok-id}:
post:
Expand Down Expand Up @@ -555,14 +547,12 @@ paths:
"created_by": {
"code": "[email protected]",
"name": "Ola Nordmann"
}
,
},
"last_updated_at": "2024-06-11T08:15:19.038Z",
"last_updated_by": {
"code": "[email protected]",
"name": "Ola Nordmann"
}
}
]
Expand Down Expand Up @@ -1218,14 +1208,12 @@ paths:
"created_by": {
"code": "[email protected]",
"name": "Ola Nordmann"
}
,
},
"last_updated_at": "2024-06-11T08:15:19.038Z",
"last_updated_by": {
"code": "[email protected]",
"name": "Ola Nordmann"
}
}
]
Expand Down Expand Up @@ -1600,14 +1588,12 @@ paths:
"created_by": {
"code": "[email protected]",
"name": "Ola Nordmann"
}
,
},
"last_updated_at": "2024-06-11T08:15:19.038Z",
"last_updated_by": {
"code": "[email protected]",
"name": "Ola Nordmann"
}
}
]
Expand Down Expand Up @@ -1768,6 +1754,7 @@ components:
- contains_special_categories_of_personal_data
- created_at
- definition
- id
- last_updated_at
- name
- owner
Expand All @@ -1782,7 +1769,6 @@ components:
type: string
description: Unique identifier for the variable definition.
format: "^[a-zA-Z0-9-_]{8}$"
nullable: true
patch_id:
type: integer
description: Integer identifying a patch of a variable definition.
Expand Down

0 comments on commit cbae8da

Please sign in to comment.