@@ -15,6 +15,7 @@ public class OpenApiReferenceTests
15
15
[ InlineData ( "#/components/schemas/Pet" , ReferenceType . Schema , "Pet" ) ]
16
16
[ InlineData ( "#/components/parameters/name" , ReferenceType . Parameter , "name" ) ]
17
17
[ InlineData ( "#/components/responses/200" , ReferenceType . Response , "200" ) ]
18
+ [ InlineData ( "#/components/schemas/HttpValidationsProblem" , ReferenceType . Schema , "HttpValidationsProblem" ) ]
18
19
public void SettingInternalReferenceForComponentsStyleReferenceShouldSucceed (
19
20
string input ,
20
21
ReferenceType type ,
@@ -43,6 +44,7 @@ public void SettingInternalReferenceForComponentsStyleReferenceShouldSucceed(
43
44
[ InlineData ( "Pet.json#/components/schemas/Pet" , "Pet.json" , "Pet" , ReferenceType . Schema ) ]
44
45
[ InlineData ( "Pet.yaml#/components/schemas/Pet" , "Pet.yaml" , "Pet" , ReferenceType . Schema ) ]
45
46
[ InlineData ( "abc#/components/schemas/Pet" , "abc" , "Pet" , ReferenceType . Schema ) ]
47
+ [ InlineData ( "abc#/components/schemas/HttpsValidationProblem" , "abc" , "HttpsValidationProblem" , ReferenceType . Schema ) ]
46
48
public void SettingExternalReferenceV3ShouldSucceed ( string expected , string externalResource , string id , ReferenceType ? type )
47
49
{
48
50
// Arrange & Act
@@ -105,6 +107,30 @@ public async Task SerializeSchemaReferenceAsJsonV3Works()
105
107
Assert . Equal ( expected , actual ) ;
106
108
}
107
109
110
+ [ Theory ]
111
+ [ InlineData ( "HttpValidationProblemDetails" , "#/components/schemas/HttpValidationProblemDetails" ) ]
112
+ [ InlineData ( "http://example.com" , "http://example.com" ) ]
113
+ [ InlineData ( "https://example.com" , "https://example.com" ) ]
114
+ public async Task SerializeHttpSchemaReferenceAsJsonV31Works ( string id , string referenceV3 )
115
+ {
116
+ // Arrange
117
+ var reference = new OpenApiReference { Type = ReferenceType . Schema , Id = id } ;
118
+ var expected =
119
+ $$ """
120
+ {
121
+ "$ref": "{{ referenceV3 }} "
122
+ }
123
+ """ ;
124
+
125
+ // Act
126
+ var actual = await reference . SerializeAsJsonAsync ( OpenApiSpecVersion . OpenApi3_1 ) ;
127
+ expected = expected . MakeLineBreaksEnvironmentNeutral ( ) ;
128
+ actual = actual . MakeLineBreaksEnvironmentNeutral ( ) ;
129
+
130
+ // Assert
131
+ Assert . Equal ( expected , actual ) ;
132
+ }
133
+
108
134
[ Fact ]
109
135
public async Task SerializeSchemaReferenceAsYamlV3Works ( )
110
136
{
0 commit comments