feat: gate fields and country-code case by declared publiccodeYmlVersion - #642
Merged
Conversation
Show and serialize only the keys that exist in the declared publiccode.yml version: - supports (since 0.7.0), organisation and fundedBy (since 0.5.0) are hidden in the editor and dropped from the YAML output when the declared version is older - country section key (IT: vs it:) and ISO 3166-1 alpha-2 codes in intendedAudience are serialized uppercase since 0.5.0 and lowercase for older versions, matching what each version of the standard mandates Values are only hidden and excluded from the output, never deleted from the form, so switching the version back and forth loses no data.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
What
Make the editor consistent with the declared
publiccodeYmlVersion: if you load/declare a 0.5.0 file you see (and export) the 0.5.0 fields, if you declare 0.7.0 you get the 0.7.0 ones.Before this, the
supportssection (introduced in 0.7.0) was always visible and serialized, so loading e.g. a 0.5.0 file and filling it produced an inconsistent YAML declaringpubliccodeYmlVersion: '0.5.0'while containing a 0.7.0-only key.How
FIELD_MIN_VERSIONSmap (supports→ 0.7.0,organisation/fundedBy→ 0.5.0, the only keys ever added after the earliest supported versions) and aisVersionAtLeastsemver helper.supports,organisationandfundedBysections are rendered only when the declared version (reactive viawatch) is at least their minimum version.IT:vsit:) and the ISO 3166-1 alpha-2 codes inintendedAudienceare now serialized uppercase from 0.5.0 onwards (previous behavior) and lowercase for older versions, matching what each version of the standard mandates. Import keeps accepting both forms.Values are only hidden and excluded from the output, never deleted from the form state: switching the version select back and forth loses no data.
Testing
supports.spec.ts,semver.spec.ts, newcountry-case.spec.ts), 82 total passing.tsc --noEmitand eslint clean.