You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
anyOf of required-only members in a request body generates unparsable code ("ruff failed") #1520
A request body whose object schema has properties plus an anyOf of members that carry only required (the usual JSON Schema way to say "at least one of these two fields") makes the generator write an endpoint module that is not valid Python. _get_kwargs gets body: Any | Unset, the if branch that serialises the body is missing, and an orphan else: is left behind. The run then ends with ruff failed, so the cause looks like a formatting problem.
I would expect either a working client (for instance the object model with both fields optional) or a clear error or warning naming the schema, as for other unsupported constructs.
openapi-python-client generate --path repro.yaml --meta none --output-path out
Error(s) encountered while generating, client was not created
Generating out
ruff failed
error: Failed to parse api/default/post_run.py:34:5: Expected a statement
Removing the anyOf generates a normal body model. An anyOf of two complete object schemas (each with its own type, properties and required) also works and gives a union of two models.
Activity