fix: OpenAPI specs based on API implementation#806
Conversation
| dependent_expense_field_values_upload_out: | ||
| type: object | ||
| additionalProperties: false | ||
| required: |
There was a problem hiding this comment.
all the modified files inside reference folder is auto generated from the updated schemas
| - band | ||
| - code | ||
| - description |
There was a problem hiding this comment.
These fields don't have required=True flag
| is_enabled: | ||
| $ref: ./fields.yaml#/is_enabled | ||
| required: | ||
| - id |
There was a problem hiding this comment.
The required list here describes response-property presence, while Marshmallow required=False controls request deserialization.
Example
This is a valid request because id, band, code, and description are optional request inputs:
{
"name": "Level 1",
"is_enabled": true
}The API still serializes all four keys in the response:
{
"id": "lvlf2yiY7usuX",
"name": "Level 1",
"band": null,
"code": null,
"description": null,
"is_enabled": true
}With the current level_out.required, generated types are approximately:
type Level = {
id: string;
band: string | null;
code: string | null;
description: string | null;
};After removing these entries, generators may produce:
type Level = {
id?: string;
band?: string | null;
code?: string | null;
description?: string | null;
};That makes external SDKs treat guaranteed response keys as potentially absent.
Verification against latest fyle-platform-api master
LevelAPISchemashows which fields may be omitted while loading requests.- The GET response fixture includes all four keys, with nullable values emitted as
null. - The POST response fixture does the same.
Please keep all four entries in level_out.required; request optionality is already represented separately by level_in.
| properties: | ||
| id: | ||
| $ref: './fields.yaml#/id_string' | ||
| nullable: true |
There was a problem hiding this comment.
The runtime API returns a string card ID, not null.
Example
Actual response shape:
{
"id": "bacctW9DfNhwOt",
"card_number": "****3464"
}This change attempts to allow a response that the runtime cannot produce:
{
"id": null,
"card_number": "****3464"
}There is also an OpenAPI 3.0.3 issue. As written:
id:
$ref: ./fields.yaml#/id_string
nullable: truenullable is a sibling of the reference and is ignored by compliant OpenAPI 3.0 tools, so the change currently has no effect. Making it effective with allOf would instead generate an unnecessarily weak type such as:
id?: string | null;Verification against latest fyle-platform-api master
- The current
PersonalCardmodel declaresidas the primary key. - The current
personal_cards_rovdefinition selectspspc.iddirectly and uses an inner join, so the view cannot produce a null card ID. - The spender GET and POST paths serialize this view through
PersonalCardROVAPISchema. - Later table migrations only add
account_type, set replica identity, and enable RLS. None changes the ID column or its nullability.
Please remove nullable: true rather than making it effective. Documenting the ID as nullable would not match runtime behavior and would weaken generated external SDK types.
dbcba50 to
39681ac
Compare
…ted_1' into single_role_non_nested_1
Description
Please add PR description here, add screenshots if needed
Clickup
app.clickup.com