Update AttachmentCreateRequest schema properties#59
Update AttachmentCreateRequest schema properties#59ramiro51 wants to merge 1 commit intofulcrumapp:v2from
Conversation
"type": "object",
"required": [
"owners"
],
"additionalProperties": false,
"properties": {
"owners": {
"type": "array",
"description": "Array of owner objects for the attachment",
"items": {
"type": "object",
"required": [
"type",
"id"
],
"properties": {
"type": {
"type": "string",
"description": "Type of the owner (e.g., 'record', 'form')"
},
"id": {
"type": "string",
"description": "Identifier of the owner"
}
}
}
},
"name": {
"type": "string",
"description": "Name of the attachment"
},
"file_size": {
"type": "integer",
"description": "Size of the file in bytes"
},
"metadata": {
"type": "object",
"description": "Optional metadata for the attachment",
"additionalProperties": true
}
}
},
|
@chrisworkmode Hi! Here is the revised version of this previous pull request after following Copilot recommendations 28c61ea |
There was a problem hiding this comment.
Pull request overview
Updates the OpenAPI schema for AttachmentCreateRequest to reflect attachment creation fields at the top level (removing the nested attachment object) and to define owners, name, file_size, and metadata directly on the request.
Changes:
- Flattened
AttachmentCreateRequestby removing theattachmentwrapper. - Promoted
owners,name,file_size, andmetadatato top-level schema properties. - Updated required fields to require
ownersat the top level.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| "owners": { | ||
| "type": "array", | ||
| "description": "Array of owner objects for the attachment", |
There was a problem hiding this comment.
The owners array is documented as requiring at least one owner for attachment creation, but the schema doesn’t enforce this. Consider adding minItems: 1 so client-side validation and generated SDKs match the API requirement.
| "description": "Array of owner objects for the attachment", | |
| "description": "Array of owner objects for the attachment", | |
| "minItems": 1, |
| "properties": { | ||
| "type": { | ||
| "type": "string", | ||
| "description": "Type of the owner (e.g., 'record', 'form')" |
There was a problem hiding this comment.
The create-attachment endpoint description indicates owner type must be either record or form, but the schema allows any string. Consider constraining this field with an enum (or a pattern) so the schema matches the documented API behavior.
| "description": "Type of the owner (e.g., 'record', 'form')" | |
| "enum": [ | |
| "record", | |
| "form" | |
| ], | |
| "description": "Type of the owner (must be either 'record' or 'form')" |
Thanks @ramiro51. For future reference, you can update your existing PR instead of creating a whole new one. Also, if your other PR is not longer necessary, please close it. |
"type": "object",
"required": [
"owners"
],
"additionalProperties": false,
"properties": {
"owners": {
"type": "array",
"description": "Array of owner objects for the attachment",
"items": {
"type": "object",
"required": [
"type",
"id"
],
"properties": {
"type": {
"type": "string",
"description": "Type of the owner (e.g., 'record', 'form')"
},
"id": {
"type": "string",
"description": "Identifier of the owner"
}
}
}
},
"name": {
"type": "string",
"description": "Name of the attachment"
},
"file_size": {
"type": "integer",
"description": "Size of the file in bytes"
},
"metadata": {
"type": "object",
"description": "Optional metadata for the attachment",
"additionalProperties": true
}
}
},