Code Monkey home page Code Monkey logo

Comments (7)

richlander avatar richlander commented on September 27, 2024 2

@Falco20019 @martincostello @omajid @leecow @rbhanda @baronfel

from core.

eiriktsarpalis avatar eiriktsarpalis commented on September 27, 2024 1

That's correct, $schema has no special meaning in the context of plain old JSON serialization. Either removing UnmappedMemberHandling or making sure that it is being mapped to a property should resolve this for you:

[JsonPropertyName("$schema")]
public Uri? Schema { get; init; }

from core.

Falco20019 avatar Falco20019 commented on September 27, 2024

You could have a separate repo on dotnet for the tooling. Would make sense also for the nuget package linking to it. Then you can release it as dotnet tool for easy usage as global tool (most propably what you suggested).

from core.

Falco20019 avatar Falco20019 commented on September 27, 2024

I just found a minor issue with https://github.com/dotnet/core/blob/main/release-notes/6.0/supported-os.json#L341

10-20h2-e-lts does not exist, only 10-20h2-e which is already correclty in unsupported-versions. If I don't forget it, I will do a PR.

from core.

richlander avatar richlander commented on September 27, 2024

I found that added a $schema node can be a breaking change.

I did the following (in order, going back a bit):

  • Wrote tools to process the various JSON files in the repo.
  • Wrote a tool to generate schema files.
  • Ran the tools.
  • Added [JsonUnmappedMemberHandling(JsonUnmappedMemberHandling.Disallow)] to the OM and re-ran the generation tool.
  • Manually added a $schema node to some of the JSON files
  • Time passed
  • Re-ran the tools. They broke.
  • Error: Unhandled exception. System.Text.Json.JsonException: The JSON property '$schema' could not be mapped to any .NET member contained in type 'DotnetRelease.OSPackagesOverview'.
  • Commenting out the JsonUnmappedMemberHandling attribute on the root object in the OM solved the problem.

The long and short of it is the following:

  • Adding a $schema node after the fact can break consumers, if they have their own custom OM.
  • Adding a $schema node prevents the use of JsonUnmappedMemberHandling.Disallow on the root object.

If there is something I'm doing wrong, that would be good to know. I don't think this finding is a huge problem, but it should influence our use of the $schema node and how we construct the schema.

@Falco20019 @eiriktsarpalis

from core.

Falco20019 avatar Falco20019 commented on September 27, 2024

Interesting finding. I would assume that JsonUnmappedMemberHandling.Disallow should not check $schema as it's a well-known node. But maybe @eiriktsarpalis can give us more insights. Maybe theres another attribute for setting the schema?

from core.

richlander avatar richlander commented on September 27, 2024

My conclusion is that STJ has no allowance for schemas meaning that the schema node is just another node.

from core.

Related Issues (20)

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.