feat(openapi): add max_output_bytes to cap response text size - #4490
Merged
Merged
Conversation
aheritier
approved these changes
Oct 1, 2026
dgageot
force-pushed
the
feat/openapi-max-output-bytes
branch
from
October 1, 2026 08:05
d4eac70 to
4d5e319
Compare
Generated OpenAPI tools return at most 30,000 bytes of response text by default, which silently drops data on APIs with larger payloads (e.g. the public PokeAPI). Add an optional max_output_bytes toolset field: omitted keeps the 30000 default, 0 disables the text cutoff, and any positive value sets a custom cap. The separate 1 MiB HTTP read limit and UTF-8 boundary safety are preserved.
dgageot
force-pushed
the
feat/openapi-max-output-bytes
branch
from
October 1, 2026 08:16
4d5e319 to
20388da
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Generated OpenAPI tools always truncated response text at 30,000 bytes. That's fine for small payloads, but it silently drops data on APIs that return larger objects — for example a public PokeAPI
pokemonlookup, whose stats and types fields land past the cutoff and never reach the model.This adds an optional
max_output_bytesfield to theopenapitoolset. Omitting it keeps today's 30,000-byte default,0disables the text cutoff entirely, and any positive integer sets a custom cap. The field is rejected by schema and config validation when used on a non-openapitoolset or set to a negative value. The separate 1 MiB HTTP response read limit is unchanged, and truncation (both the new cutoff and the existing 1 MiB cap) still cuts on a UTF-8 rune boundary so output is never left with a partial multi-byte character.examples/openapi-pokemon.yamland the docs atdocs/tools/openapi/index.mdshow the new field in use.This is backward compatible: existing configs that don't set
max_output_bytesbehave exactly as before.