contrib
contrib copied to clipboard
feat(entoas): add field descriptions and fix examples
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.
- Had to move away from the
- 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 edgefriend
which is associated via.Field("friend_id")
, results in POST requests both havingfriend
andfriend_id
being required, but they both set the same thing.
- Example: a field of
- Edge requests (e.g.
/owners/<id>/pets
) now have tags for both types, if they differ (e.g.Owner
andPet
, rather than justOwner
).