@@ -754,6 +754,37 @@ public void ReadJson_ImplicitExternalTypes_AllowSharedNamespace()
754754 Assert . Equal ( new [ ] { "My Test String" } , ( ( ExternalSchemaModelSharedNamespace ) actual ) . MyCustomProperty ) ;
755755 }
756756
757+ [ Fact ]
758+ public void ReadJson_Values_AllowComments ( )
759+ {
760+ var json = /*lang=json*/
761+ """
762+ {
763+ "Property": [
764+ {
765+ "@context": "https://schema.org",
766+ "@type": "Book",
767+ "@id": "https://example.com/book/1",
768+ "name": "The Catcher in the Rye", // This is the book name
769+ "url": "https://www.barnesandnoble.com/store/info/offer/JDSalinger",
770+ "author": {
771+ "@type": "Person",
772+ "name": "J.D. Salinger" // Author name
773+ }
774+ }
775+ ]
776+ }
777+ """ ;
778+ var result = DeserializeObject < Values < string , IBook > > ( json ) ;
779+ var actual = result . Value2 . ToArray ( ) ;
780+
781+ Assert . Equal ( new Uri ( "https://example.com/book/1" ) , ( ( Book ) actual [ 0 ] ) . Id ) ;
782+ Assert . Equal ( "The Catcher in the Rye" , actual [ 0 ] . Name ) ;
783+ Assert . Equal ( new Uri ( "https://www.barnesandnoble.com/store/info/offer/JDSalinger" ) , ( Uri ) actual [ 0 ] . Url ! ) ;
784+ var author1 = Assert . Single ( actual [ 0 ] . Author . Value2 ) ;
785+ Assert . Equal ( "J.D. Salinger" , author1 . Name ) ;
786+ }
787+
757788 private static string SerializeObject < T > ( T value )
758789 where T : struct , IValues
759790 => SchemaSerializer . SerializeObject ( new TestModel < T > { Property = value } ) ;
0 commit comments