Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cli/test/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ describe("error handling", () => {
status: 400,
code: "INVALID_REQUEST",
message: "Bad request",
details: { field: "email" },
details: { errors: [{ field: "email" }] },
},
});

const parsed = JSON.parse(stdout);
expect(parsed.success).toBe(false);
expect(parsed.error.code).toBe("INVALID_REQUEST");
expect(parsed.error.details).toEqual({ field: "email" });
expect(parsed.error.details).toEqual({ errors: [{ field: "email" }] });
// The whole error envelope must not be nested under details.
expect(parsed.error.details.code).toBeUndefined();
});
Expand Down
29 changes: 22 additions & 7 deletions mintlify/openapi.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 22 additions & 7 deletions openapi.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 8 additions & 9 deletions openapi/components/schemas/errors/Error400.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,14 @@ properties:
description: >-
Additional error details. Shape varies by `code`. For field-validation
errors on submit endpoints (e.g. `POST /customers`, `PATCH /customers/{id}`),
`details.field` and `details.constraint` are populated so platforms can
pre-validate their onboarding form before re-submitting.
`details.errors[]` enumerates every invalid field so platforms can render
form-field-level UX for the entire request in a single round-trip.
properties:
field:
type: string
errors:
type: array
description: >-
Dot-notation path to the offending field. Present on field-validation
errors from submit endpoints.
example: taxIdentifier
constraint:
$ref: ./FieldConstraint.yaml
One entry per invalid field. Present on field-validation errors from
submit endpoints.
items:
$ref: ./FieldError.yaml
Comment on lines +107 to +113

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Obsolete Error400 test fixture

The only repository test for Error400.details still constructs and asserts the removed { field: "email" } shape, so it provides no regression coverage for parsing the new errors array and nested FieldError properties. Update the fixture and assertion alongside this contract change.

Prompt To Fix With AI
This is a comment left during a code review.
Path: openapi/components/schemas/errors/Error400.yaml
Line: 107-113

Comment:
**Obsolete Error400 test fixture**

The only repository test for `Error400.details` still constructs and asserts the removed `{ field: "email" }` shape, so it provides no regression coverage for parsing the new `errors` array and nested `FieldError` properties. Update the fixture and assertion alongside this contract change.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — fixed in 06d7b8cb. Updated the cli/test/client.test.ts fixture and its assertion to use details: { errors: [{ field: "email" }] }, matching the new FieldError[] array contract. The test's behavior-under-test (CLI passes details through verbatim, and the whole error envelope is not nested under details) is unchanged.


🤖 staking-corona-30(#30) | Feedback

additionalProperties: true
19 changes: 19 additions & 0 deletions openapi/components/schemas/errors/FieldError.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
type: object
required:
- field
description: >-
One field-level validation failure. Field-validation errors on submit
endpoints (e.g. `POST /customers`, `PATCH /customers/{id}`) emit an array of
these under `details.errors` so platforms can render form-field-level UX
for every failure in a single round-trip.
properties:
field:
type: string
description: Dot-notation path to the offending field.
example: taxIdentifier
constraint:
$ref: ./FieldConstraint.yaml
message:
type: string
description: Human-readable explanation of what's wrong with this field.
example: Value is not one of the allowed enum members.
Loading