Skip to content

Commit f0cd62e

Browse files
jfallowsclaude
andauthored
feat(common-yaml): self-contained streaming YAML parse + generate (#1845)
* Add common-yaml module * Add mvnw * test(common-yaml): use text blocks for YAML test fixtures Address PR review: convert String.join("\n", ...) fixtures in YamlParserTest and YamlGeneratorTest to Java text blocks for readability, preserving exact string content (trailing newlines and indentation). https://claude.ai/code/session_019JPttETjpAWQX8aKyxxocE * perf(common-yaml): traverse parser events lazily * feat(common-yaml): complete yaml parser uptake * feat(common-yaml): split yaml provider APIs * refactor(common-yaml): isolate yaml json api * feat(common-yaml): cover json parser compatibility * feat(common-yaml): expand native yaml api * refactor(engine): centralize yaml document iteration * refactor(common-yaml): tighten yaml object api * refactor(common-yaml): tighten yaml array api * feat(common-yaml): register yaml json provider * feat(common-yaml): provide json model locally * feat(common-yaml): support json parser skipping * feat(common-yaml): preserve native yaml source * feat(common-yaml): improve yaml parser fidelity * feat(common-yaml): emit native yaml metadata * feat(common-yaml): preserve native yaml fidelity * feat(common-yaml): add yaml factories and config * feat(common-yaml): support native yaml mapping keys * test(common-yaml): cover json as yaml documents * feat(common-yaml): propagate yaml json parser config * test(common-yaml): audit yaml json provider drop-in * feat(common-yaml): add native yaml builders * feat(common-yaml): apply yaml generator config * test(common-yaml): cover yaml alias merge regressions * feat(common-yaml): enforce json-as-yaml parser profile * feat(common-yaml): support native builder metadata * fix(common-yaml): avoid json provider registration * test(common-yaml): add yaml conformance baseline * fix(common-yaml): handle document marker directives * fix(common-yaml): improve block scalar parsing * fix(common-yaml): handle flow collection edge cases * fix(common-yaml): handle tab indentation contexts * fix(common-yaml): allow duplicate anchor overrides * fix(common-yaml): tighten invalid yaml rejection * fix(common-yaml): close invalid yaml conformance gaps * fix(common-yaml): improve flow scalar conformance * fix(common-yaml): support compact block sequences * fix(common-yaml): preserve block scalar whitespace * fix(common-yaml): resolve explicit nonspecific scalars * test(common-yaml): unskip passing conformance cases * fix(common-yaml): improve folded block scalars * fix(common-yaml): project scalar yaml keys * test(common-yaml): unskip passing yaml conformance keys * fix(common-yaml): fold multiline plain scalars * fix(common-yaml): handle block scalar indentation * fix(common-yaml): fold multiline quoted scalars * fix(common-yaml): improve quoted and plain scalar edges * fix(common-yaml): preserve trailing block scalar spaces * fix(common-yaml): fold explicit scalar keys * fix(common-yaml): align compact sequence continuations * fix(common-yaml): handle flow scalar edge cases * fix(common-yaml): handle anchor key edge cases * fix(common-yaml): handle yaml document streams * fix(common-yaml): fold directive-like scalar lines * fix(common-yaml): align yaml json tags and streams * fix(yaml): validate config streams explicitly * test(common-yaml): cover native yaml branches * fix(model-avro): remove unused module dependencies * fix(docker-image): common-yaml dependency * fix(common-yaml): NOTICEs for dependent modules * fix(binding-openapi): use yaml json provider for openapi parser * test(common-yaml): vendor YAML conformance suite instead of downloading Vendor the yaml-test-suite data-2022-01-17 cases (in.yaml, in.json, error, ===) under src/test/resources at the test class package path, in a dated subdirectory. YamlConformanceTest now resolves the suite via getClass().getResource() rather than fetching and unzipping the archive from GitHub at build time, so the conformance run is hermetic and offline. Exclude the vendored suite from the license-header check. * test(common-yaml): always run YAML conformance suite Remove the zilla.yaml.conformance enable gate so the conformance cases run on every build, guarding against regressions. Also drop the now-dead strict/gaps skip machinery (both gap sets were empty); every vendored case is asserted unconditionally. * feat(common-yaml): optional unique mapping key enforcement in JSON parser Add a FEATURE_UNIQUE_KEYS config flag, configurable through the jakarta.json config map on YamlJson parser/reader factories. When enabled, YamlJsonParser rejects duplicate sibling mapping keys with a JsonParsingException at parse time, walking the projected node tree. Disabled by default, so existing last-wins projection and conformance behavior is unchanged. * feat(common-yaml): config-aware YamlJsonProvider Add a YamlJsonProvider constructor and YamlJson.provider(Map) overload that carry a jakarta.json config map through to every parser/reader the provider creates. This lets callers enable FEATURE_UNIQUE_KEYS (and other features) at the provider level, not just via the parser/reader factories. * feat(engine): enforce unique config keys at YAML parse time Parse zilla.yaml through a YamlJson provider with FEATURE_UNIQUE_KEYS enabled, so duplicate mapping keys are rejected during parsing with a JsonParsingException. Removes the justify-based UniquePropertyKeysSchema decorator (and its now-unused SchemaDecorator base) in favor of the common-yaml parse-time enforcement, keeping duplicate-key detection out of the JSON Schema validator's scope. * build: upgrade JSON-B to Jakarta EE 10 Bump jakarta.json.bind-api 2.0.0 -> 3.0.1 and yasson 2.0.3 -> 3.0.4, aligning JSON-B with the EE 10 jakarta.json-api 2.1 / parsson already in use. No source changes required: the JsonbAdapter / JsonbConfig surface is unchanged across JSON-B 2.0 -> 3.0, and no module references yasson internals. * feat(engine): validate zilla.yaml with common-json, drop justify Replace the leadpony justify JSON Schema validator in EngineConfigReader with the provider-free common-json JsonSchema validator (#1859), removing justify (and its transitive json-api binding) from the engine so the runtime is clean on Jakarta EE 10. Config is parsed through a YamlJson provider with FEATURE_UNIQUE_KEYS enabled, so duplicate mapping keys are rejected at parse time; each document is then validated against the compiled schema, with diagnostics collected only when validation fails (common-json reports failed anyOf branches to the reporter even when an alternative branch matches, so the boolean verdict is authoritative). Also corrects an invalid "type": "String" to "string" in the engine.spec test binding schema patch — justify silently ignored the unknown type, but common-json correctly rejects it at schema compile time. Regenerated engine NOTICE (justify and transitive ICU4J dropped). * build(binding-tls): regenerate NOTICE after justify removal Engine no longer depends on leadpony justify, so binding-tls no longer picks up justify (or its transitive ICU4J) and now picks up common-json. Regenerated via notice:generate. * build: regenerate NOTICEs after justify removal from engine binding-echo and command-log no longer pick up justify (or transitive ICU4J) now that engine dropped it; they gain common-json. Also refreshes binding-openapi-asyncapi, which had drifted (Jackson/SnakeYAML -> parsson/ common-yaml) and correctly retains justify via binding-openapi/-asyncapi. Regenerated via notice:generate. * feat(binding-asyncapi): validate specs with common-json, drop justify Migrate AsyncapiParser off leadpony justify onto the common-json JsonSchema validator (gating errors on the boolean verdict). The bundled AsyncAPI 2.6/3.0 meta-schemas are self-contained (all $ref resolve in-document via $id, including the bundled draft-07 meta-schema), so no resolver or network access is involved. Engine no longer exposes justify transitively, so this also restores compilation of binding-asyncapi; swaps the module-info requires and pom dependency to common-json and regenerates NOTICE. Also fixes an over-escaped host:port regex in the asyncapi schema patch (\\{ -> \{): justify never compiled it, but common-json uses strict java.util.regex which correctly rejected the doubled backslash. * feat(binding-openapi): validate specs with common-json, drop justify Migrate OpenapiParser off leadpony justify onto the common-json JsonSchema validator (gating errors on the boolean verdict). The bundled OpenAPI 3.0 (draft-04) and 3.1 (2020-12) meta-schemas are self-contained with local refs, so no resolver or network access is involved. Engine no longer exposes justify transitively, so this also restores compilation of binding-openapi; swaps the module-info requires and pom dependency to common-json and regenerates NOTICE. Removes a host:port regex from the openapi schema patch's servers[].url: that pattern only matches host[:port], not the full URLs OpenAPI server entries use (e.g. http://localhost:9090/prod). It was previously over-escaped and therefore uncompilable, so justify never enforced it; common-json compiles patterns with strict java.util.regex, which exposed the mismatch. (AsyncAPI keeps the host:port pattern, which is correct for its host:port server style.) * feat(model-json): validate payloads with common-json, drop justify Migrate JsonModelHandler and JsonValidatorHandler off leadpony justify onto the common-json JsonSchema validator, removing justify from model-json. Validation now uses schema.validate(parser) and reports failures via the diagnostics consumer (gated on the boolean verdict). Because common-json consumes the parser internally rather than exposing a validating parser, the converter handlers validate in one pass and extract field byte-offsets in a second pass. FOLLOW-UP: restore single-pass once common-json offers a validating/forwarding parser (validatingParser, deferred in #1859). Updates the model-json event spec message to common-json's diagnostic wording and regenerates NOTICE (justify/ICU4J -> common-json). * feat(engine.spec): validate configs with common-json in ConfigSchemaRule, drop justify Migrate the ConfigSchemaRule test rule off leadpony justify onto the common-json JsonSchema validator: parse the config with YamlJson, validate against the compiled schema (gating on the boolean verdict), and throw jakarta.json.JsonException on failure (matching the exception type SchemaTest negative cases expect, as justify's JsonValidatingException extended JsonException). Swaps the pom dependency and module-info requires to common-json and regenerates NOTICE. This was the last justify call site. * build: remove leadpony justify from the build entirely With all call sites migrated to common-json (engine, binding-openapi, binding-asyncapi, model-json, engine.spec ConfigSchemaRule), remove the last justify references: - drop justify from root pom dependencyManagement - drop the stale justify module-info requires in binding-openapi-asyncapi and the stale justify shade include in binding-tcp - update the three SchemaTest negative cases (binding-http, binding-mcp, binding-http-kafka) to expect jakarta.json.JsonException (ConfigSchemaRule now throws JsonException, as justify's JsonValidatingException extended it) - regenerate 55 downstream NOTICE files that transitively listed justify/ICU4J (via engine.spec), now reflecting common-json and the EE 10 yasson/parsson Full-repo 'mvnw clean install -DskipTests' passes (every module compiles without justify, all NOTICE and license checks pass); only the docker-image step is skipped here for lack of a Docker daemon. * refactor: use common-json single-pass validating parser, drop gate-on-boolean With #1861 merged (streaming ValidatingParser + corrected anyOf/oneOf child diagnostic reporting), simplify the common-json call sites: - model-json JsonModelHandler validates and extracts field byte-offsets in a single pass again via schema.newParser(true, parser), catching JsonValidationException — removing the temporary 2-pass validate+extract. - engine EngineConfigReader, binding-asyncapi and binding-openapi parsers now collect diagnostics inline (schema.validate(parser, errors::add)); the gate-on-boolean workaround is no longer needed since failed anyOf/oneOf branches are no longer reported on conforming input. - engine.spec ConfigSchemaRule validates by draining schema.newParser(true, ...), which throws JsonValidationException (a JsonException) on non-conformance. Verified: engine, model-json, engine.spec, binding-asyncapi, binding-openapi all green (clean verify). * fix(binding-risingwave): drop bogus host:port pattern from udf server The udf[].server field holds full URLs (e.g. http://localhost:8815), but the schema patch constrained it with an over-escaped host:port regex (\\{ -> illegal java.util.regex repetition). justify never compiled/enforced it, so the defect was dormant; common-json compiles patterns strictly and surfaced it via the full clean install. Remove the pattern (leaving type:string), matching the openapi servers[].url fix; the asyncapi/risingwave host:port server fields that genuinely are host:port keep the corrected pattern. * fix(model-avro): restore jackson module reads required by avro at runtime Commit 2074f47 dropped 'requires com.fasterxml.jackson.core/databind' from model-avro's module-info as unused — they have no direct source reference, but Apache Avro (Schema.Parser and the vendored org.apache.avro.io JSON encoders/decoders) uses jackson at runtime. Without the reads, moditect prunes jackson from the modular runtime image and avro schema resolution fails with NoClassDefFoundError: com.fasterxml.jackson.core.JsonParseException. Restore the reads. (Eliminating jackson is deferred to the model-avro -> common-avro streaming-parser + common-json projection work.) * fix(binding-openapi): read common-yaml used by OpenapiParser OpenapiParser uses YamlJson (common-yaml) to read the OpenAPI document, but the module neither declared the dependency nor read the module, so in the modular runtime it failed with IllegalAccessError: does not read module common.yaml (seen via the openapi.proxy and openapi.asyncapi.kafka.proxy examples). Add the common-yaml dependency and module read, matching binding-asyncapi. * fix(model-avro): declare explicit jackson dependency for modular runtime image The common-yaml work removed jackson-dataformat-yaml from engine, so engine no longer drags jackson-core/databind into the linked (jlink/zpm) module set. The shaded Apache Avro JSON codec in model-avro genuinely uses jackson at runtime (module-info reads restored in 056b17b), but model-avro never declared jackson itself - it free-rode on engine's transitive contribution. With that gone, the runtime image link fails: FindException: Module com.fasterxml.jackson.core not found, required by io.aklivity.zilla.runtime.model.avro Make jackson a first-class dependency of model-avro (its real consumer): add explicit jackson-core + jackson-databind, version-managed by a jackson-bom import in the root dependencyManagement. Jackson stays an external named module (not shaded) - the shade still bundles only org.apache.avro:avro. https://claude.ai/code/session_019JPttETjpAWQX8aKyxxocE * fix(binding-openapi): open http-kafka extension package for JSON-B reflection Yasson reflects into OpenapiHttpKafkaOperationExtension to read its fields, but the package was not opened to the module system. opens is not recursive, so the existing opens of internal.model did not cover the extensions.http.kafka subpackage, causing an IllegalAccessException only on the modular runtime image. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent ed0eaa1 commit f0cd62e

1,365 files changed

Lines changed: 20791 additions & 803 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cloud/NOTICE

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Licensed under the Apache License, Version 2.0 (the
2+
"License"); you may not use this file except in compliance
3+
with the License. You may obtain a copy of the License at:
4+
5+
http://www.apache.org/licenses/LICENSE-2.0
6+
7+
Unless required by applicable law or agreed to in writing,
8+
software distributed under the License is distributed on
9+
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
10+
KIND, either express or implied. See the License for the
11+
specific language governing permissions and limitations
12+
under the License.
13+
14+
This project includes:
15+

cloud/docker-image/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@
3737
<version>${project.version}</version>
3838
<scope>runtime</scope>
3939
</dependency>
40+
<dependency>
41+
<groupId>${project.groupId}</groupId>
42+
<artifactId>common-yaml</artifactId>
43+
<version>${project.version}</version>
44+
<scope>runtime</scope>
45+
</dependency>
4046
<dependency>
4147
<groupId>${project.groupId}</groupId>
4248
<artifactId>manager</artifactId>

cloud/docker-image/src/main/docker/zpm.json.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"io.aklivity.zilla:catalog-karapace",
4646
"io.aklivity.zilla:catalog-schema-registry",
4747
"io.aklivity.zilla:common",
48+
"io.aklivity.zilla:common-yaml",
4849
"io.aklivity.zilla:command",
4950
"io.aklivity.zilla:command-dump",
5051
"io.aklivity.zilla:command-metrics",

conf/NOTICE

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Licensed under the Apache License, Version 2.0 (the
2+
"License"); you may not use this file except in compliance
3+
with the License. You may obtain a copy of the License at:
4+
5+
http://www.apache.org/licenses/LICENSE-2.0
6+
7+
Unless required by applicable law or agreed to in writing,
8+
software distributed under the License is distributed on
9+
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
10+
KIND, either express or implied. See the License for the
11+
specific language governing permissions and limitations
12+
under the License.
13+
14+
This project includes:
15+

incubator/NOTICE

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Licensed under the Apache License, Version 2.0 (the
2+
"License"); you may not use this file except in compliance
3+
with the License. You may obtain a copy of the License at:
4+
5+
http://www.apache.org/licenses/LICENSE-2.0
6+
7+
Unless required by applicable law or agreed to in writing,
8+
software distributed under the License is distributed on
9+
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
10+
KIND, either express or implied. See the License for the
11+
specific language governing permissions and limitations
12+
under the License.
13+
14+
This project includes:
15+
agrona under The Apache License, Version 2.0
16+
Apache Commons CLI under Apache License, Version 2.0
17+
Jakarta JSON Processing API under Eclipse Public License 2.0 or GNU General Public License, version 2 with the GNU Classpath Exception
18+
zilla::runtime::common-json under Aklivity Community License Agreement
19+
zilla::runtime::common-yaml under Aklivity Community License Agreement
20+
zilla::specs::binding-kafka.spec under The Apache Software License, Version 2.0
21+
zilla::specs::binding-proxy.spec under The Apache Software License, Version 2.0
22+
zilla::specs::engine.spec under The Apache Software License, Version 2.0
23+

incubator/binding-amqp.spec/NOTICE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ under the License.
1313

1414
This project includes:
1515
agrona under The Apache License, Version 2.0
16-
ICU4J under Unicode/ICU License
1716
Jakarta JSON Processing API under Eclipse Public License 2.0 or GNU General Public License, version 2 with the GNU Classpath Exception
18-
org.leadpony.justify under The Apache Software License, Version 2.0
17+
zilla::runtime::common-json under Aklivity Community License Agreement
18+
zilla::runtime::common-yaml under Aklivity Community License Agreement
1919
zilla::specs::engine.spec under The Apache Software License, Version 2.0
2020

2121

incubator/binding-pgsql-kafka.spec/NOTICE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ specific language governing permissions and limitations under the License.
1111

1212
This project includes:
1313
agrona under The Apache License, Version 2.0
14-
ICU4J under Unicode/ICU License
1514
Jakarta JSON Processing API under Eclipse Public License 2.0 or GNU General Public License, version 2 with the GNU Classpath Exception
16-
org.leadpony.justify under The Apache Software License, Version 2.0
1715
zilla::incubator::binding-pgsql.spec under Aklivity Community License Agreement
16+
zilla::runtime::common-json under Aklivity Community License Agreement
17+
zilla::runtime::common-yaml under Aklivity Community License Agreement
1818
zilla::specs::binding-kafka.spec under The Apache Software License, Version 2.0
1919
zilla::specs::binding-proxy.spec under The Apache Software License, Version 2.0
2020
zilla::specs::engine.spec under The Apache Software License, Version 2.0

incubator/binding-pgsql.spec/NOTICE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ specific language governing permissions and limitations under the License.
1111

1212
This project includes:
1313
agrona under The Apache License, Version 2.0
14-
ICU4J under Unicode/ICU License
1514
Jakarta JSON Processing API under Eclipse Public License 2.0 or GNU General Public License, version 2 with the GNU Classpath Exception
16-
org.leadpony.justify under The Apache Software License, Version 2.0
15+
zilla::runtime::common-json under Aklivity Community License Agreement
16+
zilla::runtime::common-yaml under Aklivity Community License Agreement
1717
zilla::specs::engine.spec under The Apache Software License, Version 2.0
1818

incubator/binding-risingwave.spec/NOTICE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ specific language governing permissions and limitations under the License.
1111

1212
This project includes:
1313
agrona under The Apache License, Version 2.0
14-
ICU4J under Unicode/ICU License
1514
Jakarta JSON Processing API under Eclipse Public License 2.0 or GNU General Public License, version 2 with the GNU Classpath Exception
16-
org.leadpony.justify under The Apache Software License, Version 2.0
1715
zilla::incubator::binding-pgsql.spec under Aklivity Community License Agreement
16+
zilla::runtime::common-json under Aklivity Community License Agreement
17+
zilla::runtime::common-yaml under Aklivity Community License Agreement
1818
zilla::specs::engine.spec under The Apache Software License, Version 2.0
1919

incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/schema/risingwave.schema.patch.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@
7373
"server":
7474
{
7575
"title": "Server",
76-
"type": "string",
77-
"pattern": "^([a-zA-Z0-9\\\\.-]+)(:(\\\\{[a-zA-Z_]+\\\\}|[0-9]+))?$"
76+
"type": "string"
7877
},
7978
"language":
8079
{

0 commit comments

Comments
 (0)