Giter Club home page Giter Club logo

Comments (4)

Fourmisain avatar Fourmisain commented on July 29, 2024 1

Hm... This is quite confusing.

So the reason why the schemaVersion turned into 1.0 is because of the way this mod is built.
It's actually 3 separate builds that get merged with a plugin I call Glue. One thing Glue does is merge the different fabric.mod.jsons by reading them via Gson, merging the resulting Map and writing one output file via Gson again.

Gson by default interprets all numbers as double values, hence the 1 is then written as 1.0.
I've now fixed this by giving Gson the ToNumberPolicy.LONG_OR_DOUBLE policy, which will parse the 1 as a long and hence write it as a 1 again.


Now to the confusing bit:
According to https://json-schema.org/understanding-json-schema/reference/numeric.html

The integer type is used for integral numbers. JSON does not have distinct types for integers and floating-point values. Therefore, the presence or absence of a decimal point is not enough to distinguish between integers and non-integers. For example, 1 and 1.0 are two ways to represent the same value in JSON. JSON Schema considers that value an integer no matter which representation was used.

Hence I do not understand why Quilt produces

MalformedSyntaxException: Found potentially valid JSON5, but invalid JSON while in strict mode $.schemaVersion

Looking into the code, it seems to come down to this line:

https://github.com/QuiltMC/quilt-json5/blob/4e9caa0e5a1c438ac89e683454b8214a8c341163/src/main/java/org/quiltmc/json5/JsonReader.java#L1154

The parser only allows for trailing decimals in JSON5 mode.

This seems to have been introduced in QuiltMC/quilt-json5@ccfa242

A strict JSON only mode has been added which will only parse valid JSON.

I've looked a bit further into this and found the JSON standard - well, actually the 3 of them: RFC 8259 , ECMA-404 and ISO/IEC 21778:2017. They are extremely short and reading them makes it very clear, that there is indeed no such thing as an integer, hence I think Quilt's JsonReader is in the wrong here and should probably be patched.

from creativeonepunch.

MeeniMc avatar MeeniMc commented on July 29, 2024

New version works as intended

from creativeonepunch.

EGOIST1372 avatar EGOIST1372 commented on July 29, 2024

why this issue is closed? there is no new version

from creativeonepunch.

MeeniMc avatar MeeniMc commented on July 29, 2024

A new version has been published on Modrinth with the same version number as on CF, but the CF version is actually an older build.

from creativeonepunch.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.