core icon indicating copy to clipboard operation
core copied to clipboard

Consider generating `releases-index.json` schema with .NET 9

Open richlander opened this issue 1 year ago • 2 comments

I read about the new JsonSchemaExporter feature. Sounds great.

I also noticed that our JSON schema was generated with different tools and is perhaps out of date.

  • https://github.com/dotnet/core/blob/main/release-notes/releases-index.json#L2
  • https://json.schemastore.org/dotnet-releases-index.json

I took a quick stab at generating a schema using this new feature. It works and I think I was able to do a decent job at replicating much of the original schema.

  • Object model: https://github.com/richlander/distroessed/blob/linux-packages/src/DotnetRelease/ReleaseIndexRecords.cs
  • Generation code: https://github.com/richlander/distroessed/blob/linux-packages/src/GenerateJsonSchemas/Program.cs
  • Result: https://gist.github.com/richlander/b05c5d6d7147ccf6d5ba04640b8aec39

Should we switch to using our own tools to generate all of our JSON schemas?

My eventual plan is to share all of this code in a more central place, particularly the DotnetRelease project. For many users, I think this project would satisfy pretty much all their needs. Perhaps we could include that in this repo.

@leecow @joeloff @Falco20019 @eiriktsarpalis @nagilson

richlander avatar Jul 18 '24 03:07 richlander

I updated the schema.

I propose:

  • Create at schemas folder at https://github.com/dotnet/core/tree/main/release-notes.
  • Add the current schema there, first, to save it in source control.
  • Update it with the generated schema.
  • Upload the new schema to replace https://json.schemastore.org/dotnet-releases-index.json.

I'm happy to do all of this, but want to give someone else first right of refusal to do the first two steps since I'm not the author of the original schema.

richlander avatar Jul 19 '24 05:07 richlander

Sounds good to me and should help keep the one in the store updated. We just need to make sure the generated one stays compatible and is not breaking anything.

I did a semantic comparison and it has at least those changes:

  • Missing $schema with added $comment and id (not sure if required)
  • Missing additionalProperties set to false on root and items (should be there to avoid additional/unknown parameters on validation)
  • definitions were removed (could lead to issues if someone was referencing them externally)
  • eol-date is not nullable anymore (strings are not nullable by default in JSON Schema; was it removed intentionally?)

Falco20019 avatar Jul 25 '24 06:07 Falco20019