We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(Related to #4360 ) v14.1.0.0
v14.1.0.0
Test below fails:
[Test] public void RefInParametersCanBeParsed() { var yamlText = @" openapi: 3.0.0 info: title: Title version: 1.0.0 paths: /items: get: operationId: items parameters: - $ref: '#/components/parameters/myHeader' responses: 200: description: Get items content: application/json: schema: type: string components: parameters: myHeader: name: myHeaderName in: header schema: type: string "; var oaDoc = OpenApiYamlDocument.FromYamlAsync(yamlText).Result!; OpenApiParameter? parameterFromFirstDoc = oaDoc.Paths.Values.Single().Values.Single().Parameters.Single(); parameterFromFirstDoc.HasReference.Should().BeTrue(); var reference = parameterFromFirstDoc.Reference!; reference.Should().BeOfType<OpenApiParameter>(); var paramFromRef = (OpenApiParameter)reference; paramFromRef.Kind.Should().Be(OpenApiParameterKind.Header); paramFromRef.Name.Should().Be("myHeaderName"); //Now let's convert this back to yaml var newYamlText = oaDoc.ToYaml(); //New yaml vs old are different, "/schema" is appended to the new one. /* + 01 02 openapi: 3.0.0 03 info: 09 operationId: items 10 parameters: - - $ref: '#/components/parameters/myHeader/schema' + 11 - $ref: '#/components/parameters/myHeader' 12 responses: 13 200: */ //newYamlText.zShould().NotDiffWith(yamlText); var newOaDoc = OpenApiYamlDocument.FromYamlAsync(newYamlText).Result!; OpenApiParameter? parameterFromNewDoc = newOaDoc.Paths.Values.Single().Values.Single().Parameters.Single(); parameterFromNewDoc.HasReference.Should().BeTrue(); var newDocReference = parameterFromNewDoc.Reference!; //This now fails ("Expected type to be NSwag.OpenApiParameter, but found NJsonSchema.JsonSchema.") newDocReference.Should().BeOfType<OpenApiParameter>(); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
(Related to #4360 )
v14.1.0.0
Test below fails:
The text was updated successfully, but these errors were encountered: