Skip to content

Commit

Permalink
Fix PresignedPostRequest definition
Browse files Browse the repository at this point in the history
Swagger codegen does not currently allow object attributes to be
readOnly directly.  To do this we need to have the object definition be
in a reference [1].  This will have the effect of changing the generated
entity types, but it will also fix a bug where `presignedPost` was
included in the writable form of `PresignedPostRequest`

Issue #1012 WritablePresignedPostRequest improperly requiring readonly property

[1] swagger-api/swagger-codegen#6537
  • Loading branch information
slifty committed May 20, 2024
1 parent 765970b commit 29cc3ef
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Several read-only fields were improperly defined, resulting in improper SDK results.
- `WritablePresignedPostRequest` will no longer require a populated `presignedPost`.

### Changed

- Created a new `PresignedPost` entity type instead of directly embedding the definition in `PresignedPostRequest`.

## 0.10.0 2024-05-03

Expand Down
37 changes: 22 additions & 15 deletions src/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -261,27 +261,34 @@
"example": 512
},
"presignedPost": {
"type": "object",
"readOnly": true,
"allOf": [
{
"$ref": "#/components/schemas/PresignedPost"
}
]
}
},
"required": ["fileType", "fileSize", "presignedPost"]
},
"PresignedPost": {
"type": "object",
"properties": {
"url": {
"type": "string"
},
"fields": {
"type": "object",
"properties": {
"url": {
"type": "string"
},
"fields": {
"type": "object",
"properties": {
"key": {
"type": "string",
"example": "96ddab90-1931-478d-8c02-a1dc80ae01e5"
}
},
"required": ["key"]
"key": {
"type": "string",
"example": "96ddab90-1931-478d-8c02-a1dc80ae01e5"
}
},
"required": ["url", "fields"]
"required": ["key"]
}
},
"required": ["fileType", "fileSize", "presignedPost"]
"required": ["url", "fields"]
},
"Proposal": {
"type": "object",
Expand Down

0 comments on commit 29cc3ef

Please sign in to comment.