-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(javascript): update Predict models error spec #980
Conversation
✅ Deploy Preview for api-clients-automation ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✗ The generated branch has been deleted.If the PR has been merged, you can check the generated code on the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good,
To keep the required
it could be done with a oneOf
, however it would also create intermediary types that are not very friendly, this works fine for me
Yep I'd personally go with a oneOf that does something like funnel_stage:
oneOf:
- '#/funnelStage'
- '#/error'
funnelStage:
type: object
description: Prediction for the **funnel_stage** model.
properties:
value:
type: array
items:
title: funnel_stage
type: object
properties:
name:
type: string
probability:
type: number
format: double
minimum: 0
maximum: 1
required:
- name
- probability
lastUpdatedAt:
type: string
required:
- value
- lastUpdatedAt
error:
type: object
description: The error when the requested model is not available
properties:
error:
type: string And similar for other objects to re-use the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tbh I did not knew my suggestion would work gg
It seems that there's duplicate names (ef67c7e#diff-ff4658ef4480ca1020bc6ddcd1e8b6fe043d35d4d28f18d5831f9df2dc53bb66R9), you might need to find an other name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
🧭 What and Why
🎟 JIRA Ticket: PRED-544
Changes included
This adapts the new error format of the Predict backend when a model is requested but that it's not available.
Here's the new response format:
Changes:
error
key in each modelvalue
andlastUpdatedAt
optional now, because they may not exist if there's an errorMaybe that we could use smarter conditional types to infer that
value
andlastUpdatedAt
do exist when there's noerror
.🧪 Test
None added.