Describe the bug
One of our integration tests seem to have flagged a regression from v1 to v2. This seems to have been tackled a couple of times, first in #1470, resolved by #1503. It then looks like Warnings were noticed to be gone and added back by #2459.
The test from #1503 still passes, but it looks like the errors is not added if the reference lives in the path (I didn't dig deeper yet).
OpenApi File To Reproduce
openapi: 3.0.3info:
title: UserAPIversion: '1.0'description: The User APIservers:
- url: 'http://localhost:3000'paths:
'/v1/users/{userId}':
parameters:
- $ref: '#/components/parameters/userId'get:
summary: Get User Info by User IDtags:
- usersresponses:
'200':
description: User Foundcontent:
application/json:
schema:
$ref: '#/components/schemas/user'description: Retrieve the information of the user with the matching user ID.components:
schemas:
User:
title: Usertype: objectdescription: ''properties:
id:
type: integerdescription: Unique identifier for the given user.firstName:
type: stringlastName:
type: stringrequired:
- id
- firstName
- lastNameparameters:
userId:
name: userIdin: pathrequired: trueschema:
type: stringdescription: the id of an existing usertags:
- name: usersExpected behavior
Since #1503 has an explicit test case containing the error I am looking for, I am assuming it is intended for there to be a "Invalid reference" error with the above file, rather than just a warning.
Screenshots/Code Snippets
Example test snippet for v1 (passes)
[Fact]publicasyncTaskValidate_ThrowsReferenceDoesntExist_Error(){// Arrangevarinput="""[...snip, use the above example...] """;varreader=newOpenApiStreamReader();awaitusingvarstream=newMemoryStream(Encoding.UTF8.GetBytes(input));// Actvarresult=awaitreader.ReadAsync(stream);// Assert(result.OpenApiDiagnostic!=null&&result.OpenApiDiagnostic.Errors.Any()).Should().BeTrue();result.OpenApiDiagnostic.Errors.Should().BeEquivalentTo(newList<OpenApiError>{new(newOpenApiException("Invalid Reference identifier 'user'."))});}The v2 equivalent:
[Fact]publicasyncTaskValidate_ThrowsReferenceDoesntExist_Error(){// Arrangevarinput="""[...snip, use the above example...] """;varsettings=newOpenApiReaderSettings();settings.AddYamlReader();awaitusingvarstream=newMemoryStream(Encoding.UTF8.GetBytes(input));// Actvarresult=awaitOpenApiDocument.LoadAsync(stream,null,settings,CancellationToken.None);// Assert(result.Diagnostic!=null&&result.Diagnostic.Errors.Any()).Should().BeTrue();result.Diagnostic.Errors.Should().BeEquivalentTo(newList<OpenApiError>{new(newOpenApiException("Invalid Reference identifier 'user'."))});}result.Diagnostic.Errors is empty, though the warning about the non-existent reference is there.
Describe the bug
One of our integration tests seem to have flagged a regression from v1 to v2. This seems to have been tackled a couple of times, first in #1470, resolved by #1503. It then looks like Warnings were noticed to be gone and added back by #2459.
The test from #1503 still passes, but it looks like the errors is not added if the reference lives in the path (I didn't dig deeper yet).
OpenApi File To Reproduce
Expected behavior
Since #1503 has an explicit test case containing the error I am looking for, I am assuming it is intended for there to be a "Invalid reference" error with the above file, rather than just a warning.
Screenshots/Code Snippets
Example test snippet for v1 (passes)
The v2 equivalent:
result.Diagnostic.Errors is empty, though the warning about the non-existent reference is there.