Skip to content
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

feat(entoas): add field descriptions and fix examples #577

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

lrstanley
Copy link

@lrstanley lrstanley commented Apr 27, 2024

This PR does a few things:

  • For all ent fields and edge requests, the description field is populated in the ogen schema.
    • Had to move away from the types map, because this was using the same fields, and changing the contents was impacting all fields of the same type. Don't see any noticeable performance difference -- not sure if this was intentional before or not.
    • Added ptr[T any](v) *v to help with code-duplication and should help with all of the pointer-to-base-types issues.
    • Fixes some cases of min/max not being properly applied.
  • The Example() annotation now works as expected. Previously, adding that annotation to any field, edge, or schema, didn't seem to have any affect.
  • When a field has a default value (function or static value), it is no longer required in POST bodies.
  • Edges which have an associated field (.Field()) that are readonly, the field is skipped for creates/updates.
  • When an edge has an associated field (.Field()) that isn't skipped, the edge object is skipped from the request body. If this isn't the case, two properties are required, which are in fact the same.
    • Example: a field of friend_id with an edge friend which is associated via .Field("friend_id"), results in POST requests both having friend and friend_id being required, but they both set the same thing.
  • Edge requests (e.g. /owners/<id>/pets) now have tags for both types, if they differ (e.g. Owner and Pet, rather than just Owner).

@giautm giautm requested a review from masseelch April 28, 2024 07:41
@lrstanley
Copy link
Author

I keep fixing bugs/inconsistencies I run across, and most are captured in this PR. I'd submit multiple PRs for each of these, but many of them are minor, so hopefully the PR isn't too big for review. I will try and avoid adding anything additional if at all possible. If there is anything specific you might want broken out, let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant