fix: std.manifestIni requires a sections field, matching official Jsonnet (#799)#886
Open
He-Pin wants to merge 1 commit into
Open
fix: std.manifestIni requires a sections field, matching official Jsonnet (#799)#886He-Pin wants to merge 1 commit into
sections field, matching official Jsonnet (#799)#886He-Pin wants to merge 1 commit into
Conversation
…sonnet (databricks#799) Motivation: sjsonnet's std.manifestIni treated `sections` as optional: `std.manifestIni({main: {a: "1"}})` returned "a = 1\n". Official Jsonnet 0.22.0 accesses `ini.sections` directly in std.jsonnet, so the same input errors with `field does not exist: sections`. Per the maintainer decision on databricks#799, follow the official approach. Modification: - In the manifestIni builtin (ManifestModule), require the `sections` field: error "Field does not exist: sections" (sjsonnet's standard field-missing wording) when absent, instead of folding to an empty section list. `main` stays optional, matching the upstream `std.objectHas(ini, 'main')` check. - Add regression tests: manifestini_sections_required (main+sections, sections-only, empty sections all work) and error.manifestini_requires_sections (missing sections errors). Result: `std.manifestIni({main: {a: "1"}})` now errors `[std.manifestIni] Field does not exist: sections`. All existing manifestIni tests already supply `sections`, so they are unaffected; full JVM test suite green. References: databricks#799
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.
Motivation
sjsonnet's
std.manifestInitreatedsectionsas optional:Official Jsonnet 0.22.0 accesses
ini.sectionsdirectly instd.jsonnet, so the same input errors withfield does not exist: sections. Per the maintainer decision on #799 ("for manifestIni, I would follow the official approach"), this aligns sjsonnet with official strictness.Modification
manifestInibuiltin (ManifestModule), require thesectionsfield — errorField does not exist: sections(sjsonnet's standard field-missing wording) when absent, instead of folding to an empty section list.mainstays optional, matching the upstreamstd.objectHas(ini, 'main')check.manifestini_sections_required.jsonnet—main+sections,sections-only, and emptysectionsall work.error.manifestini_requires_sections.jsonnet— missingsectionserrors.Result
All existing
manifestInitests already supplysections(the test suite uses the proper{main, sections}schema), so they are unaffected. Full JVM (Scala 3) test suite green.Note: this PR addresses only the
manifestInihalf of #799. ThemanifestTomlformatting differences (leading blank lines / nested-table indentation) are left for a separate discussion, as the desired behavior there was still open.Addresses #799 (manifestIni).