-
Notifications
You must be signed in to change notification settings - Fork 3.6k
12660 bugapi create one person post api request example is returning 400 in playground #12787
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
12660 bugapi create one person post api request example is returning 400 in playground #12787
Conversation
📊 API Changes ReportREST API ChangesSummary🔄 Changed Operations (117)
|
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.
PR Summary
Enhanced OpenAPI documentation with realistic example data using Faker.js for better API playground experience and testing.
- Added new
generate-random-field-value.utils.ts
using Faker.js to generate realistic example data for all field types - Modified
components.utils.ts
to streamline schema generation with a simplifiedforUpdate
parameter - Added example data generation for various field types (currency, emails, names, links) in OpenAPI schema components
- Updated
request-body.utils.ts
to include UUID examples for the findDuplicates endpoint - Refactored
camelToTitleCase.ts
to improve code readability by reordering transformation steps
5 files reviewed, 7 comments
Edit PR Review Bot Settings | Greptile
packages/twenty-server/src/engine/core-modules/open-api/utils/request-body.utils.ts
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/open-api/utils/request-body.utils.ts
Outdated
Show resolved
Hide resolved
...ages/twenty-server/src/engine/core-modules/open-api/utils/__tests__/components.utils.spec.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/open-api/utils/components.utils.ts
Show resolved
Hide resolved
...es/twenty-server/src/engine/core-modules/open-api/utils/generate-random-field-value.utils.ts
Show resolved
Hide resolved
case FieldMetadataType.SELECT: { | ||
return field.options[0].value; | ||
} |
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.
logic: Potential runtime error if field.options is empty array. Add null check before accessing index 0.
...es/twenty-server/src/engine/core-modules/open-api/utils/generate-random-field-value.utils.ts
Outdated
Show resolved
Hide resolved
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:36445 This environment will automatically shut down when the PR is closed or after 5 hours. |
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.
Very cool to be working on that ! Interesting !
Left few comments and nitpicks
Please let me know
|
||
case FieldMetadataType.EMAILS: { | ||
return { | ||
primaryEmail: faker.internet.email().toLowerCase(), |
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.
Nitpick: would pass a deterministic twenty
domain
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.
why? for a person email that would have not a lot of sense isn't it?
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.
I always tend to generate "controlled" email addresses for the sake of local testing, just in case :p
...es/twenty-server/src/engine/core-modules/open-api/utils/generate-random-field-value.utils.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/open-api/utils/components.utils.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/open-api/utils/request-body.utils.ts
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/open-api/utils/components.utils.ts
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/open-api/utils/components.utils.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/open-api/utils/components.utils.ts
Outdated
Show resolved
Hide resolved
Very cool and smooth to test thing quickly from the REST API now |
@FelixMalfait if you could still review the diff checker bot stacktrace which is unless I'm mistaken a false positive as we've massively updated the open api schema. Tho I'm still wondering why examples would raise breaking changes, @martmull maybe changes made to the We should dig deeper if possible to wait before merging |
Use faker to provide simple working examples for REST API create one, create many, update one and find duplicates
Eg:
