Skip field with __get_pydantic_json_schema__
#9494
Unanswered
pigexperiment
asked this question in
Question
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is it possible to implement something similar to
SkipJsonSchema
through__get_pydantic_json_schema__
?I want to use custom schema generators, along with context variables, to modify the json schema.
One such use would to skip fields in the json schema depending on the context.
I see that
SkipJsonSchema
simply raises aPydanticOmit
error, but when I raise it in custom types, the exception isn't handled, and it does not work.Is this a bug? If not is there some other way to achieve what I am after?
I am using pydantic 2.7.1
Beta Was this translation helpful? Give feedback.
All reactions