Repository navigation
Move YAML to SharpYaml and report unknown keys as errors - #4506
Merged
Merged
Conversation
Contributor
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4506/ Sample changed pages: |
akira28
approved these changes
Oct 19, 2026
Mpdreamz
force-pushed
the
feature/move-to-sharpyaml
branch
from
October 20, 2026 10:27
472a4d8 to
5ffe9e8
Compare
Mpdreamz
force-pushed
the
feature/move-to-sharpyaml
branch
from
October 20, 2026 10:44
5ffe9e8 to
33d9d4b
Compare
Replace YamlDotNet and its static generator with SharpYaml 3.16.0, which supports source-generated, AOT-safe deserialization and reports unmapped members with a path, position and suggestion. Unknown keys are now errors with a message such as `Unknown key 'fiel' in $.toc[1]. Did you mean 'file'?`, reported at the key's file line. Config files without a collector throw one exception listing every unknown key. Hand-written converters report through the same path, so a mistyped toc entry is no longer dropped silently. A per-key policy hook tolerates keys that content repositories still use (`platforms`, `warning`, `tip`, `important`, `type`, `comment`) as hints, tracked in [elastic/docs-eng-team#1075](elastic/docs-eng-team#1075) and [elastic/docs-eng-team#1076](elastic/docs-eng-team#1076). `meta_title` is now a first-class `YamlFrontMatter` field rather than a tolerated key. SharpYaml 3.16.0 also lets changelog fields serialize as `|` block literals again and removes the trailing-newline workaround. `OpenApiReader` now reads the scalar value of quoted path keys, which the migration had broken for specs such as `cloud-billing.yaml`. `BundleBackportsYaml` stayed `internal` while its sibling DTOs went `public` for the generator, so the generated public `YamlTypeInfo<BundleBackportsYaml>` accessor tripped `CS0053`; it is `public` now like the rest. Three `Elastic.Changelog` files still had `using YamlDotNet.Core;` for `YamlException`; they now use `SharpYaml`. A changelog bundling test and a frontmatter test asserted the old writer's indentation and an outdated tolerated-key list; both now match SharpYaml's actual output. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Co-Authored-By: Claude Sonnet 5 <[email protected]> Co-authored-by: Cursor <[email protected]>
Mpdreamz
force-pushed
the
feature/move-to-sharpyaml
branch
from
October 20, 2026 11:12
33d9d4b to
5008fe2
Compare
…ont matter The hub-whats-new.yml cache was keyed by path only, so after a typo the cached error replayed on every watch-mode build until a restart. Key the cached parse by the file content as well. Comment-only front matter deserializes to null, and ProcessYamlFrontMatter dereferenced it. Read it as empty front matter. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TjZFCvQhL3DdrcjFKU6jDT
reakaleek
added a commit
that referenced
this pull request
Oct 22, 2026
…move #4506 replaced YamlDotNet with SharpYaml, so `YamlMember` no longer resolves in `PublishEnvironment`. The merged CI build failed to compile on every OS. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
reakaleek
added a commit
that referenced
this pull request
Oct 22, 2026
* Send page feedback through the AWS WAF SDK when an environment sets its URL The web ACL can require an `aws-waf-token` cookie on `/docs/_api/v1/page-feedback`. A plain `fetch()` cannot solve the challenge. `waf_integration_url` in `config/assembler.yml` now flows into `window.__DOCS_CONFIG__`, and `<page-feedback>` loads that SDK and sends the `PUT` through `AwsWafIntegration.fetch`. With no URL, nothing loads and the call uses plain `fetch()`. If the SDK fails to load, the submit shows the normal error state. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> * Use `YamlPropertyName` for `waf_integration_url` after the SharpYaml move #4506 replaced YamlDotNet with SharpYaml, so `YamlMember` no longer resolves in `PublishEnvironment`. The merged CI build failed to compile on every OS. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> --------- Co-authored-by: Jan Calanog <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]>
This was referenced Nov 4, 2026
1 of 3 tasks
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.
YAML parsing moves from
YamlDotNettoSharpYaml. A typo in any YAML config now fails the build with a location and a correction, instead of being silently dropped.Affects: Configuration, Release notes, Authoring
Prompt summary: Replace
YamlDotNetwithSharpYamlacross the configuration, changelog, and Markdown front matter pipelines, and make unmapped YAML keys a build-breaking diagnostic rather than a silent no-op.Why
YamlDotNet's source generator (Vecc.YamlDotNet.Analyzers.StaticGenerator) requires every serializable type to be listed by hand, and nothing in the pipeline reported an unmapped key back to the author. A typo likepath_prefxinnavigation.ymldeserialized without error, the field it meant to set stayed at its default, and the mistake surfaced later as a confusing navigation bug instead of a build failure at the point of the typo.What
Unknown keys fail the build with a location and a correction
Every YAML config file —
docset.yml,navigation.yml,products.yml, changelog entries, changelog bundles, and Markdown front matter — now reports an unmapped key throughYamlUnmappedMemberDiagnostics, with a Levenshtein-distance suggestion when one is close enough, or the full list of valid keys when it is not. For example, anavigation.ymlwithpath_prefx: get-startedinstead ofpath_prefix: get-startednow fails with:A key that is not a near match lists the real options instead of guessing:
A changelog entry with
desciption:instead ofdescription:fails with a line and column, since changelog entries parse from committed files on disk:The same check runs inside a changelog bundle's nested
products:list, with the path to the offending entry included:And Markdown front matter catches the same class of mistake, for example
navigaton_title:instead ofnavigation_title::A small, fixed set of legacy front matter keys (
type,comment) stay tolerated as hints rather than errors, viaYamlUnknownKeyPolicies.ToleratedAsHint, so older content does not break on a key the author never controlled.YAML and JSON serialization now share one API surface
SharpYaml's source generator,YamlSerializerContext, mirrorsSystem.Text.Json'sJsonSerializerContextclosely enough that the two now share types directly.YamlStaticContextsetsPropertyNamingPolicy = JsonKnownNamingPolicy.SnakeCaseLower— the same enumSystem.Text.Json.Serializationdefines for JSON — and SharpYaml'sUnmappedMemberHandlingandPreferredObjectCreationHandlingareJsonUnmappedMemberHandlingandJsonObjectCreationHandlingvalues, not SharpYaml-specific ones. A converter or naming policy written for one serializer now reads correctly for the other, and a contributor who already knowsSystem.Text.Json's source-generation attributes already knows most ofSharpYaml's.SharpYaml over YamlDotNet
SharpYaml's generator discovers every type reachable from a root[YamlSerializable]registration on its own;YamlDotNet's required every nested type listed explicitly, so adding a field of a new type meant a second edit in the generator config to keep it working. Unmapped-key reporting with suggestions is a feature of the generator itself rather than something this repo had to build againstYamlDotNetto begin with. The migration also removes a workaround for aYamlDotNetmulti-line string bug —|block literals round-trip correctly underSharpYaml— and a manual trailing-newline fix-up that the old writer needed and the new one does not.Trailing fixes from the migration
A handful of config DTOs stayed
internalafter the pass that made their siblingspublicto satisfy SharpYaml's generator, which requires public types for public serialization members;BundleBackportsYamlis nowpubliclike the rest ofElastic.Documentation.Configuration.Changelog. Three files inElastic.Changelogstill referencedYamlDotNet.CoreforYamlExceptionafter the swap. Two changelog tests asserted on hardcoded YAML indentation that changed becauseSharpYaml's writer indents a sequence under its parent mapping key, whereYamlDotNet's default was indentless; the assertions now match the new, equally valid, output. A third changelog test normalizes its fixture's line endings, sinceSharpYamlonly picks the block-literal style for a description free of\r, and a Windows checkout of the raw string literal otherwise broke the assertion.elastic/curator'sex_reindex.mdhas anavigation_titetypo thatYamlDotNetsilently ignored; it now reports as a hint instead of an error for that one file and points at the fix, elastic/curator#1798, and still errors everywhere else.Verify
Note: A
docset.yml,navigation.yml,products.yml, changelog entry, changelog bundle, or Markdown front matter file with a key that was previously silently ignored now fails the build instead of swallowing the typo. Fix the typo, or add the key to its DTO if it is meant to be read. elastic/curator#1798 is the first content fix this surfaced.