public async Task <IActionResult> Post( [FromQuery] string operationIds = null, [FromQuery] string tags = null, [FromQuery] string url = null, [FromQuery] string openApiVersion = null, [FromQuery] string title = "Partial Graph API", [FromQuery] OpenApiStyle style = OpenApiStyle.Plain, [FromQuery] string format = null, [FromQuery] string graphVersion = null, [FromQuery] bool forceRefresh = false) { try { OpenApiStyleOptions styleOptions = new OpenApiStyleOptions(style, openApiVersion, graphVersion, format); string graphUri = GetVersionUri(styleOptions.GraphVersion); if (graphUri == null) { throw new InvalidOperationException($"Unsupported {nameof(graphVersion)} provided: '{graphVersion}'"); } OpenApiDocument source = await OpenApiService.ConvertCsdlToOpenApiAsync(Request.Body); var predicate = await OpenApiService.CreatePredicate(operationIds, tags, url, source, forceRefresh); var subsetOpenApiDocument = OpenApiService.CreateFilteredDocument(source, title, styleOptions.GraphVersion, predicate); subsetOpenApiDocument = OpenApiService.ApplyStyle(styleOptions.Style, subsetOpenApiDocument); var stream = OpenApiService.SerializeOpenApiDocument(subsetOpenApiDocument, styleOptions); if (styleOptions.OpenApiFormat == "yaml") { return(new FileStreamResult(stream, "text/yaml")); } else { return(new FileStreamResult(stream, "application/json")); } } catch (InvalidOperationException ex) { return(new JsonResult(ex.Message) { StatusCode = StatusCodes.Status400BadRequest }); } catch (ArgumentException ex) { return(new JsonResult(ex.Message) { StatusCode = StatusCodes.Status404NotFound }); } catch (Exception ex) { return(new JsonResult(ex.Message) { StatusCode = StatusCodes.Status500InternalServerError }); } }