Services\OpenApiGeneratorTests.cs (99)
27var operation = GetOpenApiOperation(() => { }, "/", Array.Empty<string>());
35var operation = GetOpenApiOperation(TestAction);
47var operation = GetOpenApiOperation(() => { });
65var operation = GetOpenApiOperation(() => { }, additionalMetadata: testBuilder.Metadata.ToArray());
77var ex = Assert.Throws<InvalidOperationException>(() => GetOpenApiOperation(lambda.Compile()));
91AssertCustomRequestFormat(GetOpenApiOperation(
94AssertCustomRequestFormat(GetOpenApiOperation(
101var operation = GetOpenApiOperation(
114var operation = GetOpenApiOperation(
131var operation = GetOpenApiOperation(
157AssertJsonResponse(GetOpenApiOperation(() => new InferredJsonClass()), "object");
158AssertJsonResponse(GetOpenApiOperation(() => (IInferredJsonInterface)null), "object");
159AssertJsonResponse(GetOpenApiOperation(() => Task.FromResult(new InferredJsonClass())), "object");
160AssertJsonResponse(GetOpenApiOperation(() => Task.FromResult((IInferredJsonInterface)null)), "object");
161AssertJsonResponse(GetOpenApiOperation(() => ValueTask.FromResult(new InferredJsonClass())), "object");
162AssertJsonResponse(GetOpenApiOperation(() => ValueTask.FromResult((IInferredJsonInterface)null)), "object");
163AssertJsonResponse(GetOpenApiOperation(() => FSharp.Core.ExtraTopLevelOperators.DefaultAsyncBuilder.Return(new InferredJsonClass())), "object");
164AssertJsonResponse(GetOpenApiOperation(() => FSharp.Core.ExtraTopLevelOperators.DefaultAsyncBuilder.Return((IInferredJsonInterface)null)), "object");
170var operation = GetOpenApiOperation(() => "foo");
188AssertVoid(GetOpenApiOperation(() => { }));
189AssertVoid(GetOpenApiOperation(() => Task.CompletedTask));
190AssertVoid(GetOpenApiOperation(() => Task.FromResult(default(FSharp.Core.Unit))));
191AssertVoid(GetOpenApiOperation(() => new ValueTask()));
192AssertVoid(GetOpenApiOperation(() => ValueTask.FromResult(default(FSharp.Core.Unit))));
193AssertVoid(GetOpenApiOperation(() => FSharp.Core.ExtraTopLevelOperators.DefaultAsyncBuilder.Return(default(FSharp.Core.Unit))));
199var operation = GetOpenApiOperation(
224var operation = GetOpenApiOperation(
246var operation = GetOpenApiOperation(
263var operation = GetOpenApiOperation(
280var operation = GetOpenApiOperation(
309var operation = GetOpenApiOperation(
337AssertPathParameter(GetOpenApiOperation((int foo) => { }, "/{foo}"));
338AssertPathParameter(GetOpenApiOperation(([FromRoute] int foo) => { }));
350AssertPathParameter(GetOpenApiOperation((TryParseStringRecord foo) => { }, pattern: "/{foo}"));
363AssertPathParameter(GetOpenApiOperation((int? foo) => { }, "/{foo}"));
364AssertPathParameter(GetOpenApiOperation(([FromRoute] int? foo) => { }));
376AssertPathParameter(GetOpenApiOperation((TryParseStringRecordStruct foo) => { }, pattern: "/{foo}"));
389AssertQueryParameter(GetOpenApiOperation((int foo) => { }, "/"), "integer");
390AssertQueryParameter(GetOpenApiOperation(([FromQuery] int foo) => { }), "integer");
391AssertQueryParameter(GetOpenApiOperation(([FromQuery] TryParseStringRecordStruct foo) => { }), "object");
392AssertQueryParameter(GetOpenApiOperation((int[] foo) => { }, "/"), "array");
393AssertQueryParameter(GetOpenApiOperation((string[] foo) => { }, "/"), "array");
394AssertQueryParameter(GetOpenApiOperation((StringValues foo) => { }, "/"), "array");
395AssertQueryParameter(GetOpenApiOperation((TryParseStringRecordStruct[] foo) => { }, "/"), "array");
401var operation = GetOpenApiOperation(([FromHeader] int foo) => { });
411Assert.Empty(GetOpenApiOperation((IInferredServiceInterface foo) => { }).Parameters);
412Assert.Empty(GetOpenApiOperation(([FromServices] int foo) => { }).Parameters);
413Assert.Empty(GetOpenApiOperation(([FromKeyedServices("foo")] int foo) => { }).Parameters);
414Assert.Empty(GetOpenApiOperation((HttpContext context) => { }).Parameters);
415Assert.Empty(GetOpenApiOperation((HttpRequest request) => { }).Parameters);
416Assert.Empty(GetOpenApiOperation((HttpResponse response) => { }).Parameters);
417Assert.Empty(GetOpenApiOperation((ClaimsPrincipal user) => { }).Parameters);
418Assert.Empty(GetOpenApiOperation((CancellationToken token) => { }).Parameters);
419Assert.Empty(GetOpenApiOperation((BindAsyncRecord context) => { }).Parameters);
433AssertBodyParameter(GetOpenApiOperation((InferredJsonClass foo) => { }), "foo", "object");
434AssertBodyParameter(GetOpenApiOperation(([FromBody] int bar) => { }), "bar", "integer");
442var operation = GetOpenApiOperation(([FromRoute] int foo, int bar, InferredJsonClass fromBody) => { });
488AssertParameters(GetOpenApiOperation(([AsParameters] ArgumentListClass req) => { }));
489AssertParameters(GetOpenApiOperation(([AsParameters] ArgumentListClassWithReadOnlyProperties req) => { }));
490AssertParameters(GetOpenApiOperation(([AsParameters] ArgumentListStruct req) => { }));
491AssertParameters(GetOpenApiOperation(([AsParameters] ArgumentListRecord req) => { }));
492AssertParameters(GetOpenApiOperation(([AsParameters] ArgumentListRecordStruct req) => { }));
493AssertParameters(GetOpenApiOperation(([AsParameters] ArgumentListRecordWithoutPositionalParameters req) => { }));
494AssertParameters(GetOpenApiOperation(([AsParameters] ArgumentListRecordWithoutAttributes req) => { }, "/{foo}"), "foo");
495AssertParameters(GetOpenApiOperation(([AsParameters] ArgumentListRecordWithoutAttributes req) => { }, "/{Foo}"));
501var operation = GetOpenApiOperation(([FromRoute] int foo, int? bar) => { });
522var operation = GetOpenApiOperation((string foo, int bar) => { });
538var operation = GetOpenApiOperation(() => "",
554var operation = GetOpenApiOperation(() => "",
570var operation = GetOpenApiOperation(() => "",
584var operation = GetOpenApiOperation(() => "",
627var operation = GetOpenApiOperation(() => "",
657var operation = GetOpenApiOperation(() => "",
683var operation = GetOpenApiOperation((InferredJsonClass inferredJsonClass) => "",
702var operation = GetOpenApiOperation((InferredJsonClass inferredJsonClass) => "");
716var operation = GetOpenApiOperation((InferredJsonClass? inferredJsonClass) => "");
730var operation = GetOpenApiOperation([Consumes("application/xml")] (InferredJsonClass? inferredJsonClass) => "");
744var operation = GetOpenApiOperation((IFormFile inferredFormFile) => "");
758var operation = GetOpenApiOperation((IFormFile? inferredFormFile) => "");
772var operation = GetOpenApiOperation((IFormFile file) => Results.NoContent());
785var operation = GetOpenApiOperation(
805var operation0 = GetOpenApiOperation((IFormFile fromFile) => { });
806var operation1 = GetOpenApiOperation((IFormFile? fromFile) => { });
832AssertFormFileParameter(GetOpenApiOperation((IFormFile file) => { }), "object", "file");
833AssertFormFileParameter(GetOpenApiOperation(([FromForm(Name = "file_name")] IFormFile file) => { }), "object", "file_name");
845var operation = GetOpenApiOperation(handler);
861var operation = GetOpenApiOperation(
873var operation = GetOpenApiOperation(() => TypedResults.Ok(new InferredJsonClass()),
892var operation = GetOpenApiOperation(([FromBody] int fromBody, [FromRoute] int fromRoute, [FromServices] int fromServices) => { });
903var operation = GetOpenApiOperation((int Id) => "", pattern);
912var operationWithNoParams = GetOpenApiOperation(() => "", "/");
921var operationWithNoBodyParams = GetOpenApiOperation((int id) => "", "/", httpMethods: new[] { "PUT" });
936ValidateParameter(GetOpenApiOperation(([FromRoute(Name = "routeName")] string param) => ""), "routeName");
937ValidateParameter(GetOpenApiOperation(([FromRoute(Name = "routeName")] string param) => "", "/{param}"), "routeName");
938ValidateParameter(GetOpenApiOperation(([FromQuery(Name = "queryName")] string param) => ""), "queryName");
939ValidateParameter(GetOpenApiOperation(([FromHeader(Name = "headerName")] string param) => ""), "headerName");
954var operation = GetOpenApiOperation(([AsParameters] AsParametersWithRequiredMembers foo) => { });
974var operation = GetOpenApiOperation(([AsParameters] AsParametersWithRequiredMembersObliviousContext foo) => { });
985var operation = GetOpenApiOperation((string[] names) => { }, httpMethods: new[] { "GET" });