Repository navigation
Getting latest code from networknt master - #12
Open
prashanthjos wants to merge 472 commits into
Open
prashanthjos wants to merge 472 commits into
prashanthjos wants to merge 472 commits into
Conversation
* Refactor format to allow more complex validation * Refactor * Refactor * Partial * Refactor * Refactor * Fix assertions behavior * Fix * Refactor date time validator * Refactor to allow for localized error messages * Add docs for unknown formats * Add tests
* Add sets view * Use set view for aggregating child errors * Optimize properties validator * Use set view * Use set view in all of * Refactor anyOf * Use set view in items * Use set view in properties * Refactor if else * Refactor * Use setview in prefixItems * Refactor DependenciesValidator * Refactor dependent schemas * Refactor * Refactor * Refactor
* Generate translations and ensure encoded in ISO-8859-1 for Java 8 * Make how schema errors are reported consistent * Refactor oneOf * Make id error message clearer * Make messages more consistent * Fix * Fix * Fix * Fix
* Fix discriminator * Fix oneOf * Filter messages for oneOf discriminator * Support discriminator in oneOf sibling * Fix * Fix * Fix * Support mappings * Refactor * Update doc
* Add native-image properties * Add meta schema mapper * Only create objects if needed * Defer some processing * Refactor * Refactor * Refactor * Refactor * Refactor
…ing (#980) * Support custom vocabularies * Refactor * Improve unknown keyword handling * Refactor * Allow configurable meta schema factory * Refactor * Refactor * Refactor * Refactor * Update docs * Update doc * Update doc * Update doc * Update doc * Update doc * Update doc
…uri conversion (#983) * Fix uri format and uri-reference format * Fix iri format and iri-reference format * Convert iri to uri
* Allow apply defaults to resolve ref and refactor walk listeners * Refactor * Refactor * Refactor * Refactor * Refactor * Refactor * Refactor * Update docs * Refactor * Refactor * Refactor * Add test
The comment said that Draft 2012-12 would be used if not stated explicitly in the schema data. This should be Draft 2020-12 instead.
Refs #1316. Co-authored-by: Steve Hu <stevehu@gmail.com> Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
* Document invalid multipleOf divisor and bound behavior Record that zero, negative and out-of-double-range multipleOf divisors are accepted when a schema is loaded, how each is treated during validation, and that numeric bounds beyond the double range compare as infinite bounds. Strict checking is left to meta-schema validation. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Qualify invalid multipleOf notes by number representation Distinguish the default double-parsing outcomes from the exact-decimal path (BigDecimal nodes and USE_BIG_DECIMAL_FOR_FLOATS), where out-of-range divisors and bounds keep their exact size. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Restore the $schema reference in the multipleOf notes Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
* Preserve lossy finite decimals in default tree readers (#1357) * Document public mapper decimals and divisor underflow policy
…ts (#1371) * Run Issue792 and DateTimeFormatTest.bothPathsRejectSpaceSeparator tests Issue792 did not match the Surefire test class name patterns and bothPathsRejectSpaceSeparator had no @test annotation, so neither ran. * Make Issue792Test tell fail-fast from no fail-fast Validate two violating properties: one error with fail-fast, two without. Fold the direct Ethlo check from bothPathsRejectSpaceSeparator into rejectsNonTSeparators, which already covers that value. * Add a test that fails when a test would never run TestDiscoveryTest scans src/test/java for test classes whose names the Surefire includes (or *IT) don't match, and for no-argument void methods that have no annotation and are not called from their file. * Tighten TestDiscoveryTest Only InternalPackageIT is exempt by name. Comments and literals are blanked before matching. A method counts as annotated only with a JUnit annotation, and as a helper only if it is called. Qualified annotations are matched. The source root comes from the test classes location, and each file is read once. Methods of nested and anonymous classes are not test candidates.
* Fix null enum rendering and loose matching with Jackson 3 * Keep enum null fix scoped to diagnostic rendering
#1377) * Reject over-long hostnames and invalid A-labels in the hostname format * Decode A-labels with Punycode instead of java.net.IDN java.net.IDN implements IDNA2003, so it rejects A-labels whose U-label has code points that IDNA2008 allows in context (U+00DF, U+03C2, U+200C, U+200D). Decode the Punycode directly, require it to round-trip, and leave the code points to the RFC 5892 rules. * Address review: keep hostname A-label checks lenient on newer code points - hostname: check A-labels with RFC5892.isValidALabel, which does not reject code points that the bundled Unicode 5.2 table lists as unassigned when the JDK assigns them (e.g. xn--ls8h.la, U+1F600, Adlam) - Lower-case A-labels before decoding, so XN--BCHER-KVA and xn--Bcher-kva pass - idn-hostname: measure the 63-character limit with Punycode.encode instead of IDN.toASCII, and limit names to 253 characters in A-label form - Check label length before the quadratic Punycode decode - Test IDNA rules once per code point instead of once per char - Make Punycode package-private and drop the unreachable grow branch - Add PunycodeTest, RFC5892Test and HostnameFormatTest - Refresh idn-hostname.json, and draft-next hostname.json and idn-hostname.json * Disable the refreshed idn-hostname cases the validator does not support yet The current suite adds idn-hostname cases for UTS 46 mapping, trailing label separators and the RFC 5893 digit rules. These are existing gaps, not regressions, so mark them disabled with a reason instead of widening this PR. * Apply the same unassigned-code-point policy to idn-hostname hostname accepted xn--ls8h.la while idn-hostname rejected it, because only hostname ignored the Unicode 5.2 table's UNASSIGNED entries. Use one rule set for both, so idn-hostname accepts every name hostname accepts. * Address second review: derive new code points, any virama, code point hyphens - Accept a code point the Unicode 5.2 table lists as unassigned only if the JDK classifies it as Ll, Lm, Lo, Mn, Mc or Nd and NFKC and lower-casing leave it unchanged, so emoji, symbols, upper case and bidi controls added since are rejected (an approximation of the RFC 5892 derivation) - Accept ZWJ and ZWNJ after any Canonical_Combining_Class Virama code point, not only U+094D, and read the preceding code point, not char - Count the RFC 5891 4.2.3.1 hyphen positions in code points - Apply RFC 5893 rules 1, 3 and 4 to any label with an R, AL or AN character - Reject Cherokee small letters, which case folding maps to the capitals - Publish the lazily loaded RFC 5892 and joining-type tables with a volatile flag instead of checking BitSet.isEmpty() outside the lock - Walk hostname labels without splitting, and check ASCII without a stream - Replace the incorrect "idn-hostname accepts everything hostname accepts" test with tests for the new rules * Judge CONTEXTO by script and step ZWNJ context by code point Found by comparing against Python idna 3.20 on every assigned code point: - KATAKANA MIDDLE DOT needs a Hiragana, Katakana or Han character anywhere in the label (RFC 5892 A.7), not only right after it. - Greek, Hebrew and Kana/Han checks use Character.UnicodeScript, not code blocks (Coptic in the Greek block, U+30FC is Common). - The ZWNJ joining-type scan steps over supplementary transparent marks by code point instead of by UTF-16 char. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U6XXMPvkRmkr5kqQuxPXm4 * Follow RFC 6452 and case folding for code points outside the 5.2 table Found by comparing against Python idna 3.20 on every assigned code point: - U+0CF1 and U+0CF2 are PVALID and U+19DA is DISALLOWED since Unicode 6.0 (RFC 6452), unlike the bundled Unicode 5.2 table. - New letters that case folding maps to another letter, such as U+1C80..U+1C88, are rejected, using lower(upper(c)) as the fold. - U+180F, a default-ignorable mark, is rejected. - New Cherokee capitals such as U+13F5 are accepted. The derivation now matches the idna PVALID table for all 41,890 code points assigned after Unicode 5.2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U6XXMPvkRmkr5kqQuxPXm4 * Apply the Bidi rule to whole names and address the third review - RFC 5893: once a label has an R, AL or AN character, every label of the name must satisfy the Bidi Rule, in idn-hostname and hostname. Re-enables the three suite cases for rules 1 and 4. - Virama list updated to Unicode 16.0 (Tulu-Tigalari, Gurung Khema). - Hyphen-position check no longer allocates. - Removes the unused block-based isGreek/isHebrew/isKatakana. - Tests: concurrent first use of the tables in a fresh class loader, name-wide Bidi, Unicode 16 virama; U+180F is skipped on JDKs that do not know it. - CHANGELOG split per change, with the known limits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U6XXMPvkRmkr5kqQuxPXm4 * Keep the virama table sorted The Unicode 16 additions were appended out of order, so the binary search missed U+11D45 and U+11D97. Adds a test that the table is sorted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U6XXMPvkRmkr5kqQuxPXm4 * Keep hostname RFC 1123 and address the fourth review - hostname applies the RFC 5893 Bidi Rule within each A-label only, so 3com.xn--mgbaam7a8h and 1a.xn--4dbc are valid again, as on 3.0.9. - Remove the public satisfiesBidiDomainRule. The cross-label rule stays private to idn-hostname, which checks only the labels without right-to-left characters, since isValidULabel already checked the rest. - HostnameFormat walks the labels once, with no split or second decode. - The hyphen check is one startsWith at the third code point. - Test the virama table against the JDK's combining classes, derived from NFD reordering, on any JDK. - HostnameFormat tests for RTL A-labels; CHANGELOG states the stricter hostname behaviour and which format applies the cross-label rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U6XXMPvkRmkr5kqQuxPXm4 * Address the fifth review - idn-hostname checks each label once: checkULabel reports whether a valid label is right-to-left, so isValid needs no second scan and no label array. Earlier labels are re-checked only when a name turns out to be a Bidi domain name. - The virama test scans every defined code point and requires an exact match with the JDK's combining classes, with no JDK version cutoff. - Pin RFC 5893 rules 4 and 5 for hostname A-labels. - CHANGELOG: use an A-label as the hostname Bidi example. - Share the reflective VIRAMAS read and tidy the test imports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U6XXMPvkRmkr5kqQuxPXm4 * Address the sixth review - The virama test always fails on a code point the table wrongly lists. A missing virama fails only when the JDK's Unicode data is not newer than the table's 16.0; on a newer JDK it is logged instead. - checkULabel returns a LabelStatus enum (INVALID, NO_RTL, HAS_RTL), declared with the other constants. - Keep the U-labels of A-labels, allocated only when a name has one, so an earlier A-label is not decoded again when the first right-to-left label appears. - Test the Punycode decoder's surrogate and out-of-range branches. - CHANGELOG: only Adlam small letters are accepted, not the capitals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U6XXMPvkRmkr5kqQuxPXm4 * Address the seventh review - Report missing post-16.0 viramas through JUnit (assumeTrue) instead of an slf4j warning, and detect a JDK newer than Unicode 16.0 from the scripts added in 17.0 (documented UnicodeScript.valueOf behaviour) rather than enum ordering, with a test for the detection. - Keep one source of truth for U-labels in isValid: each label is replaced by its U-label in place, so the Bidi back-check reads labels[m] with no fallback and no extra array. * Address the eighth review - idn-hostname accepts at most one trailing label separator (split with limit -1); a.. and xn--4dbc.. are now rejected, and the single root separator still does not count toward 253 characters. CHANGELOG updated. - Make the Unicode-version detection testable: the script lookup is a parameter, so both results are exercised on every JDK, and the missing-virama decision is extracted and tested for both branches. - isACE uses regionMatches instead of allocating a substring, and the LTR/RTL rule predicates are composed once instead of per label. - isValid Javadoc covers the cross-label Bidi rule and the trailing separator. --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Steve Hu <stevehu@gmail.com>
* Reject a trailing label separator in idn-hostname The JSON-Schema-Test-Suite treats a trailing label separator (example., example。, example., example。) as an invalid idn-hostname, and hostname already rejects a trailing dot. #1377 still accepted one trailing separator. Reject it, and re-enable the 16 upstream cases that were disabled for it. * Address review: list as a breaking change, drop labelCount, test every separator and label kind The trailing-separator rejection gets its own Breaking changes entry in Unreleased, because 3.0.9 and earlier accepted example. and an upgrade now rejects it. It no longer reads as part of the #1377 entry. labelCount was only needed to drop one trailing empty label, so labels.length is used directly. rejectsTrailingLabelSeparators now tries all four separators after an ASCII label, a U-label and an A-label, alone and as the last label of a two-label name. Each name is first asserted valid without the separator, so the rejection is caused by the trailing separator alone. * Address review: list the idn-hostname rules, test the format class The isValid Javadoc lists the rules instead of joining them in the @return sentence, and names leading and doubled separators along with the trailing one. idnHostnameFormatRejectsTrailingLabelSeparator checks the IdnHostnameFormat contract directly, not only RFC5892.isValid.
* Reject spaces and backslashes in uri-template literals RFC 6570 section 2.1 excludes the space and the backslash from template literals, but the uri-template pattern accepted both. Add them to the excluded characters, add a unit test, and update the vendored uri-template.json suite files (draft 6, 7, 2019-09, 2020-12 and draft-next) to the current JSON-Schema-Test-Suite. * Limit uri-template literals to the RFC 6570 character set Address review: the literal class now lists RFC 6570 section 2.1's ranges (the ASCII characters, ucschar and iprivate) instead of excluding a few characters. C1 controls, lone surrogates, noncharacters, U+FFF0 to U+FFFD and U+E0000 to U+E0FFF are rejected in a literal. The apostrophe stays valid, as in the JSON-Schema-Test-Suite. UriTemplateFormatTest checks the pattern against a predicate written from the RFC's ABNF for every code point, and covers the reviewed examples directly. * Address review: match uri-template runs possessively, list as breaking The uri-template pattern recursed once per character, so a 5,000-character literal or a 1,000-character variable name threw StackOverflowError. Runs of literal characters and of varchars are now matched possessively, which needs no stack per character. The literal set is unchanged: the ASCII, BMP and supplementary characters are three classes, and the ASCII class lists its characters one by one so java.util.regex compiles it to a bit set. UriTemplateFormatTest adds long-input cases, which overflow the previous pattern, and rejects a stray brace or percent sign. FormatValidatorTest.uriTemplateRejectsSpaceAndBackslashInLiteral is removed, as UriTemplateFormatTest covers the same inputs. The CHANGELOG entry moves to Breaking changes, and a Fixed entry covers the stack overflow. * Address review: use String.repeat in UriTemplateFormatTest
* Check the authority of uri, uri-reference, iri and iri-reference java.net.URI falls back to a registry-based authority when it cannot parse the authority as a server, and then checks neither the port, the userinfo nor the host. So http://example.com:abc/path, //a@b@example.com/, http://[::ffff:01.2.3.4] and an IPv6 address without brackets were accepted. AbstractRFC3986Format now checks a parsed authority against RFC 3986 section 3.2 for all four formats: the port is digits only, the userinfo holds no other "@", the host is a reg-name or an IPv6 literal without leading zeros in an embedded IPv4 address (reusing the ipv6 pattern), and the IRI formats also allow RFC 3987 ucschar in the userinfo and the host. URI#parseServerAuthority() is not used because it rejects valid reg-names such as a_b.example. http:// and about: (#1071) stay valid. Add the 12 failing JSON-Schema-Test-Suite cases to the vendored uri, uri-reference, iri and iri-reference suite files (draft 6, 7, 2019-09, 2020-12 and draft-next) and a unit test for the edge cases. Closes #1389 * Address review: IRI hosts, bidi characters, zone ids and cleanup - IriFormat and IriReferenceFormat no longer run the IPv6 pattern on the decoded authority, which rejected a valid reg-name such as 1%3A%3A2. The port check already rejects an IPv6 address without brackets. - The IRI formats reject the bidirectional formatting characters U+200E, U+200F and U+202A to U+202E in the userinfo and the host (RFC 3987 section 4.1). - The bracketed host is checked with a new IPv6Format.isValid, shared with the ipv6 format, instead of a copy of its checks. The branches for a missing "]" and for the port after "]" are removed: java.net.URI only returns a bracketed host after a successful server parse. - UriAuthorityFormatTest drops two rows that never reached the new code and covers the cases above. - The uri cases are added to the draft 3 and draft 4 suite files too. - CHANGELOG: zone ids are now rejected, iri and iri-reference already rejected an IPv6 address without brackets, and third-party subclasses of AbstractRFC3986Format get the check and the isInternationalized() hook. * Reject bidi formatting characters anywhere in an IRI RFC 3987 section 4.1 forbids the bidirectional formatting characters U+200E, U+200F and U+202A to U+202E anywhere in an IRI, not only in the authority. iri and iri-reference now reject them in the path, the query and the fragment too; the check moves from ucschar to the whole value. The CHANGELOG example for a second "@" now uses an absolute URI, and an unrelated whitespace change is reverted. * Address review: guard the IPv6 bracket, wider bidi set, IRI-only bidi check - The bracketed host check returns false instead of throwing if no "]" follows the "[". - The IRI formats also reject U+061C (ALM) and the isolates U+2066 to U+2069, which can reorder the displayed text like the RFC 3987 list. - The bidi check moves into IriFormat and IriReferenceFormat, so isInternationalized() controls only ucschar in the userinfo and host. It scans with a charAt loop. - The draft 3 suite change is reverted: draft 3 has no runner. - Tests cover bidi in the userinfo, a percent-encoded bidi character, and the added characters. The CHANGELOG is updated. * Make containsBidiFormatting available to IRI-like subclasses Address review: a subclass of AbstractRFC3986Format in another package for an IRI-like format can now call containsBidiFormatting from its validate(), and the CHANGELOG says it should.
* Fix typos in documentation Signed-off-by: Hamid Zare <12127420+hamidzr@users.noreply.github.com> * docs: fix remaining typos and table padding Signed-off-by: Hamid Zare <12127420+hamidzr@users.noreply.github.com> --------- Signed-off-by: Hamid Zare <12127420+hamidzr@users.noreply.github.com>
…nce (#1391) * Tighten the fallback regex for uri, uri-reference, iri and iri-reference A scheme must start with a letter, and the comma is no longer allowed. // is valid only for uri-reference and iri-reference. * Address review: check the original value and validate the fallback Pass the value as it is to handleException, since JDK 25 can trim or empty the exception input. Check a fallback value with validate(URI), using / for its empty path, so the // rule lives in the base class and custom formats get it. Accept scheme ":" "#" fragment. * Reject [ and ] outside an IP-literal in all four formats java.net.URI accepts them in the fragment and in an opaque part, such as urn:a[b. Check them once in AbstractRFC3986Format, instead of the query only in each format. * Address review: overridable bracket check, duplicate test row containsMisplacedBracket is protected, so a subclass can accept ?tags[]=a. Replace the duplicate :// row with the iri case.
* Skip serializing string nodes for const error arguments * Use asStringOpt for const error arguments
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.
No description provided.