Kunal8954 commented on code in PR #72470:
URL: https://github.com/apache/airflow/pull/72470#discussion_r3925418985
##########
airflow-core/src/airflow/api_fastapi/common/headers.py:
##########
@@ -27,10 +27,18 @@ def header_accept_json_or_text_depends(
accept: Annotated[
str,
Header(
+ description="The response content type to negotiate for.",
+ # Listed as "examples", not "enum": a real Accept header isn't
restricted to
+ # these exact literals (it may carry q-values, be comma-separated,
etc.), and
+ # an "enum" containing the literal "*/*" gets rendered by some
OpenAPI client
+ # generators (notably the Java generator) as a named enum constant
whose
+ # generated Javadoc embeds that raw value - the "*/" inside it
prematurely
+ # closes the Javadoc comment block and breaks the generated client.
+ # See https://github.com/apache/airflow/issues/72466
json_schema_extra={
"type": "string",
- "enum": [Mimetype.JSON, Mimetype.TEXT, Mimetype.ANY],
- }
+ "examples": [Mimetype.JSON, Mimetype.TEXT, Mimetype.ANY],
Review Comment:
Thanks for pushing on this - your question about testing with the actual
generator was the right one to ask, and it turned up something important.
1. Title updated (dropped the `fix:` prefix per the contributing guide).
2. Added a regression test (test_headers.py) for the schema-level change.
3. On your question about OpenAPI Generator - I generated *and compiled*
the Java client against the regenerated spec. Compilation still fails,
both before and after this PR's change. The actual break isn't the
enum constant I originally suspected - it's the `@param accept
(optional, default to */*)` Javadoc line, which comes from the header's
`default` value and is unescaped by openapi-generator's Java template
regardless of enum vs examples. I've filed the real bug upstream:
OpenAPITools/openapi-generator#<TBD>, and updated this PR's description
to reflect that it's a valid improvement (enum was the wrong keyword)
but doesn't fully close #72466 on its own.
Given that, happy to take direction on whether you'd rather this PR stay
scoped as-is (with an honest description) or be closed until there's an
upstream fix to point to - your call.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]