generate: the document outgrew snakeyaml's ceiling, and cpp is the third departure
Two changes, both about the same thing: what a language needs before its projection compiles, stated once where the invocation is. generate.py — swagger-parser hands hanzo.yaml to snakeyaml, which refuses anything over 3 * 1024 * 1024 = 3145728 code points. The document passed that mark at1a2ca06(3,654,449) and the failure does not say so: the parser logs SnakeException, silently falls through to the SWAGGER 2.0 compat reader, and dies with "Issues with the OpenAPI input" — which reads like a malformed spec. It is not. The document validates at 0 errors and 0 warnings (240 "unused model" recommendations). -DmaxYamlCodePoints is a parser default and nothing else, and it stops EVERY language at once, so it belongs here rather than being rediscovered separately in seven repos. sdks.yaml — cpp joins go and rust as deliberately absent, for the reason already stated for rust plus one of its own. It needs four cpp-restsdk mustache overrides before the output compiles at all, and a template is a FILE that has to sit beside the invocation; and it needs generator 7.24.0, not the 7.14.0 pinned here. On 7.14.0 the document leaves 10 of 2370 translation units uncompilable through two defects in the generator's Java type resolution that no template reaches — an aliased array's element type dropped under additionalProperties (9 TUs), and an integer-backed enum declared over utility::string_t and defined over int32_t (1 TU). A row here says one version for everyone, so raising the pin fleet-wide would rewrite every other client's committed output: a separate deliberate decision, not a side effect of adding C++. The floor is stated once, in hanzo-cpp/sdk's own scripts/generate.sh. Measured on aarch64 Ubuntu 24.04, g++ 13.3, generator 7.24.0, spec1a2ca06: 2376 translation units, 0 fail. Co-authored-by: Hanzo Dev <[email protected]>
This commit is contained in:
+10
-1
@@ -96,7 +96,16 @@ def emit(name, cfg, spec, version, out):
|
||||
"apiDocs=false", "modelDocs=false", "apiTests=false", "modelTests=false"]
|
||||
glob += [f"{k}={v}" for k, v in cfg.get("global", {}).items()]
|
||||
cmd = [
|
||||
"java", "-Xmx2g", "-jar", jar(version), "generate",
|
||||
# -DmaxYamlCodePoints: swagger-parser hands the document to snakeyaml,
|
||||
# which refuses anything over 3 * 1024 * 1024 = 3145728 code points.
|
||||
# hanzo.yaml passed that mark at 1bac13f (3,654,449) and the parser does
|
||||
# not say so plainly — it logs SnakeException, silently falls through to
|
||||
# the Swagger 2.0 compat reader, and dies with "Issues with the OpenAPI
|
||||
# input", which reads like a malformed spec. It is not: the document
|
||||
# validates at 0 errors and 0 warnings. A parser default, nothing else,
|
||||
# and it stops EVERY language at once — so it is set here, once, rather
|
||||
# than discovered separately in seven repos.
|
||||
"java", "-Xmx2g", "-DmaxYamlCodePoints=99999999", "-jar", jar(version), "generate",
|
||||
"-g", cfg["generator"],
|
||||
"-i", spec,
|
||||
"-o", out,
|
||||
|
||||
@@ -233,3 +233,34 @@ sdks:
|
||||
# signature), `packageVersion: 8.0.0` (the SPEC's version — the crate shipped
|
||||
# 0.1.0 as a first publish), and it pointed at `crates/hanzo-cloud`, which
|
||||
# hanzo-rs/sdk does not have.
|
||||
|
||||
# cpp is DELIBERATELY ABSENT, and it is the third departure — for exactly the
|
||||
# reason stated for rust, plus one of its own.
|
||||
#
|
||||
# • TEMPLATES. Four `cpp-restsdk` mustache overrides are required before the
|
||||
# output compiles at all, and a template is a FILE that has to sit beside
|
||||
# the invocation. They fix five defect classes in the generator's own
|
||||
# codegen: oneOf explicit instantiations emitted HTML-escaped; oneOf
|
||||
# visitors calling members the alternatives do not have; a oneOf class that
|
||||
# stands outside ModelBase and so cannot be a FIELD of another model; a
|
||||
# free-form `object` held by value with no ModelBase overload; and an
|
||||
# API response container resolved separately from its element type.
|
||||
# • the GENERATOR VERSION. C++ needs 7.24.0, not the 7.14.0 pinned above. On
|
||||
# 7.14.0 this document leaves 10 of 2370 translation units uncompilable
|
||||
# through two defects in the generator's Java type resolution that no
|
||||
# template reaches — mustache interpolates the strings resolution
|
||||
# produces, it cannot recompute a type. Both are fixed in 7.24.0:
|
||||
# `additionalProperties: {$ref: <array-typed schema>}` dropping the
|
||||
# aliased array's element type (9 TUs, vector_NamedVectors ->
|
||||
# vector_DenseVector), and an integer-backed enum declaring its conversion
|
||||
# helpers over utility::string_t while defining them over int32_t (1 TU,
|
||||
# framework_Document.docstatus).
|
||||
#
|
||||
# A row here says one version for everyone, so raising the pin fleet-wide
|
||||
# would rewrite every other client's committed output — a separate, deliberate
|
||||
# decision, not a side effect of adding C++. The floor is therefore stated
|
||||
# once, where the invocation is: hanzo-cpp/sdk's own scripts/generate.sh. Same
|
||||
# document, same driver-shaped seam, same --check contract.
|
||||
#
|
||||
# Canonical repo is hanzo-cpp/sdk; `hanzoai/cpp-sdk` is a rename redirect to
|
||||
# it.
|
||||
|
||||
Reference in New Issue
Block a user