这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@danielgtaylor
Copy link
Owner

This PR changes how the example and enum field tags are processed to enable using them for types which provide a custom schema, such as OmittableNullable[int]. The type checking now happens via the JSON Schema rather than the Go type, enabling a custom type which says it's an e.g. integer to match with enum values like 1,2,3.

Note: this does not enable the use of defaults with type that provide custom schemas. Since defaults need to be type-cast to the Go type and assigned dynamically this is not currently possible with custom types.

Fixes #228

@codecov
Copy link

codecov bot commented Feb 15, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (ff83e16) 94.48% compared to head (04887d7) 94.48%.
Report is 2 commits behind head on main.

Files Patch % Lines
schema.go 96.36% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #242   +/-   ##
=======================================
  Coverage   94.48%   94.48%           
=======================================
  Files          18       18           
  Lines        2609     2648   +39     
=======================================
+ Hits         2465     2502   +37     
- Misses        106      107    +1     
- Partials       38       39    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@danielgtaylor danielgtaylor merged commit 0e5a8bb into main Feb 15, 2024
@danielgtaylor danielgtaylor deleted the custom-schema-example branch February 15, 2024 16:31
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.

Panic when using example or enum struct tag for OmittableNullable

2 participants