Skip to content

[STJ] Disallow property names that conflict with metadata property names #106390

Closed

Description

@eiriktsarpalis

I think the best course of action is to disallow properties that conflict with type discriminators. It produces JSON with duplicate properties that cannot be roundtripped -- the failure of the schema exporter is merely a side-effect of configuration being invalid.

Originally posted by @eiriktsarpalis in dotnet/aspnetcore#56575 (comment)

This should include conflicting type discriminator id's, as well as reference types containing $id or $ref in cases where reference preservation has been enabled.

Activity

  1. added
    untriaged
    on Aug 14, 2024
  2. dotnet-policy-service commented on Aug 14, 2024

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis
    See info in area-owners.md if you want to be subscribed.

  3. removed
    untriaged
    on Aug 14, 2024
  4. added this to the 10.0.0 milestone on Aug 14, 2024
  5. added
    enhancement
    breaking-change
    on Aug 14, 2024
  6. added
    needs-breaking-change-doc-created
    on Aug 14, 2024
  7. dotnet-policy-service commented on Aug 14, 2024

    @dotnet-policy-service
    Contributor

    Added needs-breaking-change-doc-created label because this issue has the breaking-change label.

    1. Create and link to this issue a matching issue in the dotnet/docs repo using the breaking change documentation template, then remove this needs-breaking-change-doc-created label.

    Tagging @dotnet/compat for awareness of the breaking change.

  8. gregsdennis commented on Aug 15, 2024

    @gregsdennis
    Contributor

    Does the usage of $id or $ref have anything to do with JSON Schema, or is it independent/other functionality?

  9. eiriktsarpalis commented on Aug 15, 2024

    @eiriktsarpalis
    MemberAuthor

    Unrelated, it's metadata being emitted when serializing with ReferenceHandler.Preserve.

  10. gregsdennis commented on Aug 15, 2024

    @gregsdennis
    Contributor

    Okay. I understand it's existing behavior, but the overlap with JSON Schema is a bit concerning for me.

  11. added
    in-pr
    on Aug 15, 2024
  12. locked and limited conversation to collaborators on Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-System.Text.Jsonbreaking-changeenhancementin-prneeds-breaking-change-doc-created

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions