Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
I create an API that has concrete types but no OpenAPI schemas are exposed. If I use Swagger generation it works fine. So when I map an API:
app.MapGet("/api/films", GetAllFilms)
.Produces<FilmResult>()
.Produces(404)
.ProducesProblem(500)
.WithName("getAllFilms")
.WithDescription("Gets all the Films")
.WithOpenApi();
There is a repo branch that replicates it: https://github.com/shawnwildermuth/BechdelDataServer/tree/issue/missingschemas
Not sure if the .Produces<FilmResult>()
is read my OpenApi, if not, the docs aren't clear.
The OpenAPI doc looksl ike:
{
"openapi": "3.0.1",
"info": {
"title": "BechdelDataServer | v1",
"version": "1.0.0"
},
"paths": {
"/api/films": {
"get": {
"tags": [
"BechdelApi"
],
"description": "Gets all the Films",
"operationId": "getAllFilms",
"parameters": [
{
"name": "page",
"in": "query",
"schema": {
"type": "integer",
"format": "int32",
"nullable": true
}
},
{
"name": "pageSize",
"in": "query",
"schema": {
"type": "integer",
"format": "int32",
"nullable": true
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"required": [
"count",
"pageCount",
"currentPage",
"results"
],
"type": "object",
"properties": {
"count": {
"type": "integer",
"format": "int32"
},
"pageCount": {
"type": "integer",
"format": "int32"
},
"currentPage": {
"type": "integer",
"format": "int32"
},
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"year": {
"type": "integer",
"format": "int32"
},
"title": {
"type": "string",
"nullable": true
},
"imdbId": {
"type": "string",
"nullable": true
},
"reason": {
"type": "string",
"nullable": true
},
"passed": {
"type": "boolean"
},
"budget": {
"type": "integer",
"format": "int32"
},
"domesticGross": {
"type": "integer",
"format": "int32"
},
"internationalGross": {
"type": "integer",
"format": "int32"
},
"posterUrl": {
"type": "string",
"nullable": true
},
"overview": {
"type": "string",
"nullable": true
},
"rating": {
"type": "number",
"format": "float"
}
}
},
"nullable": true
}
}
}
}
}
},
"404": {
"description": "Not Found"
},
"500": {
"description": "Internal Server Error",
"content": {
"application/problem+json": {
"schema": {
"type": "object",
"properties": {
"type": {
"type": "string",
"nullable": true
},
"title": {
"type": "string",
"nullable": true
},
"status": {
"type": "integer",
"format": "int32",
"nullable": true
},
"detail": {
"type": "string",
"nullable": true
},
"instance": {
"type": "string",
"nullable": true
}
}
}
}
}
}
},
"x-aspnetcore-id": "8845b872-28db-412d-8c3d-47b61a7e9b85"
}
},
"/api/film": {
"get": {
"tags": [
"BechdelDataServer"
],
"description": "Get's a film",
"operationId": "getFilm",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"year": {
"type": "integer",
"format": "int32"
},
"title": {
"type": "string",
"nullable": true
},
"imdbId": {
"type": "string",
"nullable": true
},
"reason": {
"type": "string",
"nullable": true
},
"passed": {
"type": "boolean"
},
"budget": {
"type": "integer",
"format": "int32"
},
"domesticGross": {
"type": "integer",
"format": "int32"
},
"internationalGross": {
"type": "integer",
"format": "int32"
},
"posterUrl": {
"type": "string",
"nullable": true
},
"overview": {
"type": "string",
"nullable": true
},
"rating": {
"type": "number",
"format": "float"
}
}
}
}
}
},
"404": {
"description": "Not Found"
},
"500": {
"description": "Internal Server Error",
"content": {
"application/problem+json": {
"schema": {
"type": "object",
"properties": {
"type": {
"type": "string",
"nullable": true
},
"title": {
"type": "string",
"nullable": true
},
"status": {
"type": "integer",
"format": "int32",
"nullable": true
},
"detail": {
"type": "string",
"nullable": true
},
"instance": {
"type": "string",
"nullable": true
}
}
}
}
}
}
},
"x-aspnetcore-id": "06446091-51f8-446c-bc0a-3ee13a7f032c"
}
},
"/api/films/{year}": {
"get": {
"tags": [
"BechdelApi"
],
"parameters": [
{
"name": "page",
"in": "query",
"schema": {
"type": "integer",
"format": "int32",
"nullable": true
}
},
{
"name": "pageSize",
"in": "query",
"schema": {
"type": "integer",
"format": "int32",
"nullable": true
}
},
{
"name": "year",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"format": "int32"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"required": [
"count",
"pageCount",
"currentPage",
"results"
],
"type": "object",
"properties": {
"count": {
"type": "integer",
"format": "int32"
},
"pageCount": {
"type": "integer",
"format": "int32"
},
"currentPage": {
"type": "integer",
"format": "int32"
},
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"year": {
"type": "integer",
"format": "int32"
},
"title": {
"type": "string",
"nullable": true
},
"imdbId": {
"type": "string",
"nullable": true
},
"reason": {
"type": "string",
"nullable": true
},
"passed": {
"type": "boolean"
},
"budget": {
"type": "integer",
"format": "int32"
},
"domesticGross": {
"type": "integer",
"format": "int32"
},
"internationalGross": {
"type": "integer",
"format": "int32"
},
"posterUrl": {
"type": "string",
"nullable": true
},
"overview": {
"type": "string",
"nullable": true
},
"rating": {
"type": "number",
"format": "float"
}
}
},
"nullable": true
}
}
}
}
}
},
"404": {
"description": "Not Found"
},
"500": {
"description": "Internal Server Error",
"content": {
"application/problem+json": {
"schema": {
"type": "object",
"properties": {
"type": {
"type": "string",
"nullable": true
},
"title": {
"type": "string",
"nullable": true
},
"status": {
"type": "integer",
"format": "int32",
"nullable": true
},
"detail": {
"type": "string",
"nullable": true
},
"instance": {
"type": "string",
"nullable": true
}
}
}
}
}
}
},
"x-aspnetcore-id": "ca2df139-e942-4235-896e-77ae517896d7"
}
},
"/api/films/failed": {
"get": {
"tags": [
"BechdelApi"
],
"parameters": [
{
"name": "page",
"in": "query",
"schema": {
"type": "integer",
"format": "int32",
"nullable": true
}
},
{
"name": "pageSize",
"in": "query",
"schema": {
"type": "integer",
"format": "int32",
"nullable": true
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"required": [
"count",
"pageCount",
"currentPage",
"results"
],
"type": "object",
"properties": {
"count": {
"type": "integer",
"format": "int32"
},
"pageCount": {
"type": "integer",
"format": "int32"
},
"currentPage": {
"type": "integer",
"format": "int32"
},
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"year": {
"type": "integer",
"format": "int32"
},
"title": {
"type": "string",
"nullable": true
},
"imdbId": {
"type": "string",
"nullable": true
},
"reason": {
"type": "string",
"nullable": true
},
"passed": {
"type": "boolean"
},
"budget": {
"type": "integer",
"format": "int32"
},
"domesticGross": {
"type": "integer",
"format": "int32"
},
"internationalGross": {
"type": "integer",
"format": "int32"
},
"posterUrl": {
"type": "string",
"nullable": true
},
"overview": {
"type": "string",
"nullable": true
},
"rating": {
"type": "number",
"format": "float"
}
}
},
"nullable": true
}
}
}
}
}
},
"404": {
"description": "Not Found"
},
"500": {
"description": "Internal Server Error",
"content": {
"application/problem+json": {
"schema": {
"type": "object",
"properties": {
"type": {
"type": "string",
"nullable": true
},
"title": {
"type": "string",
"nullable": true
},
"status": {
"type": "integer",
"format": "int32",
"nullable": true
},
"detail": {
"type": "string",
"nullable": true
},
"instance": {
"type": "string",
"nullable": true
}
}
}
}
}
}
},
"x-aspnetcore-id": "75eee808-5442-4cfd-8ba7-a041a281bde9"
}
},
"/api/films/passed": {
"get": {
"tags": [
"BechdelApi"
],
"parameters": [
{
"name": "page",
"in": "query",
"schema": {
"type": "integer",
"format": "int32",
"nullable": true
}
},
{
"name": "pageSize",
"in": "query",
"schema": {
"type": "integer",
"format": "int32",
"nullable": true
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"required": [
"count",
"pageCount",
"currentPage",
"results"
],
"type": "object",
"properties": {
"count": {
"type": "integer",
"format": "int32"
},
"pageCount": {
"type": "integer",
"format": "int32"
},
"currentPage": {
"type": "integer",
"format": "int32"
},
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"year": {
"type": "integer",
"format": "int32"
},
"title": {
"type": "string",
"nullable": true
},
"imdbId": {
"type": "string",
"nullable": true
},
"reason": {
"type": "string",
"nullable": true
},
"passed": {
"type": "boolean"
},
"budget": {
"type": "integer",
"format": "int32"
},
"domesticGross": {
"type": "integer",
"format": "int32"
},
"internationalGross": {
"type": "integer",
"format": "int32"
},
"posterUrl": {
"type": "string",
"nullable": true
},
"overview": {
"type": "string",
"nullable": true
},
"rating": {
"type": "number",
"format": "float"
}
}
},
"nullable": true
}
}
}
}
}
},
"404": {
"description": "Not Found"
},
"500": {
"description": "Internal Server Error",
"content": {
"application/problem+json": {
"schema": {
"type": "object",
"properties": {
"type": {
"type": "string",
"nullable": true
},
"title": {
"type": "string",
"nullable": true
},
"status": {
"type": "integer",
"format": "int32",
"nullable": true
},
"detail": {
"type": "string",
"nullable": true
},
"instance": {
"type": "string",
"nullable": true
}
}
}
}
}
}
},
"x-aspnetcore-id": "96f4d3ac-1612-46a8-b972-5cadaf370950"
}
},
"/api/films/failed/{year}": {
"get": {
"tags": [
"BechdelApi"
],
"parameters": [
{
"name": "year",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"format": "int32"
}
},
{
"name": "page",
"in": "query",
"schema": {
"type": "integer",
"format": "int32",
"nullable": true
}
},
{
"name": "pageSize",
"in": "query",
"schema": {
"type": "integer",
"format": "int32",
"nullable": true
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"required": [
"count",
"pageCount",
"currentPage",
"results"
],
"type": "object",
"properties": {
"count": {
"type": "integer",
"format": "int32"
},
"pageCount": {
"type": "integer",
"format": "int32"
},
"currentPage": {
"type": "integer",
"format": "int32"
},
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"year": {
"type": "integer",
"format": "int32"
},
"title": {
"type": "string",
"nullable": true
},
"imdbId": {
"type": "string",
"nullable": true
},
"reason": {
"type": "string",
"nullable": true
},
"passed": {
"type": "boolean"
},
"budget": {
"type": "integer",
"format": "int32"
},
"domesticGross": {
"type": "integer",
"format": "int32"
},
"internationalGross": {
"type": "integer",
"format": "int32"
},
"posterUrl": {
"type": "string",
"nullable": true
},
"overview": {
"type": "string",
"nullable": true
},
"rating": {
"type": "number",
"format": "float"
}
}
},
"nullable": true
}
}
}
}
}
},
"404": {
"description": "Not Found"
},
"500": {
"description": "Internal Server Error",
"content": {
"application/problem+json": {
"schema": {
"type": "object",
"properties": {
"type": {
"type": "string",
"nullable": true
},
"title": {
"type": "string",
"nullable": true
},
"status": {
"type": "integer",
"format": "int32",
"nullable": true
},
"detail": {
"type": "string",
"nullable": true
},
"instance": {
"type": "string",
"nullable": true
}
}
}
}
}
}
},
"x-aspnetcore-id": "ea830310-002c-4b9a-9f0c-b5408888c509"
}
},
"/api/films/passed/{year}": {
"get": {
"tags": [
"BechdelApi"
],
"parameters": [
{
"name": "year",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"format": "int32"
}
},
{
"name": "page",
"in": "query",
"schema": {
"type": "integer",
"format": "int32",
"nullable": true
}
},
{
"name": "pageSize",
"in": "query",
"schema": {
"type": "integer",
"format": "int32",
"nullable": true
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"required": [
"count",
"pageCount",
"currentPage",
"results"
],
"type": "object",
"properties": {
"count": {
"type": "integer",
"format": "int32"
},
"pageCount": {
"type": "integer",
"format": "int32"
},
"currentPage": {
"type": "integer",
"format": "int32"
},
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"year": {
"type": "integer",
"format": "int32"
},
"title": {
"type": "string",
"nullable": true
},
"imdbId": {
"type": "string",
"nullable": true
},
"reason": {
"type": "string",
"nullable": true
},
"passed": {
"type": "boolean"
},
"budget": {
"type": "integer",
"format": "int32"
},
"domesticGross": {
"type": "integer",
"format": "int32"
},
"internationalGross": {
"type": "integer",
"format": "int32"
},
"posterUrl": {
"type": "string",
"nullable": true
},
"overview": {
"type": "string",
"nullable": true
},
"rating": {
"type": "number",
"format": "float"
}
}
},
"nullable": true
}
}
}
}
}
},
"404": {
"description": "Not Found"
},
"500": {
"description": "Internal Server Error",
"content": {
"application/problem+json": {
"schema": {
"type": "object",
"properties": {
"type": {
"type": "string",
"nullable": true
},
"title": {
"type": "string",
"nullable": true
},
"status": {
"type": "integer",
"format": "int32",
"nullable": true
},
"detail": {
"type": "string",
"nullable": true
},
"instance": {
"type": "string",
"nullable": true
}
}
}
}
}
}
},
"x-aspnetcore-id": "9b89b7cb-9e7b-43ae-91bd-cf39c10fd66b"
}
},
"/api/years": {
"get": {
"tags": [
"BechdelApi"
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
},
"500": {
"description": "Internal Server Error",
"content": {
"application/problem+json": {
"schema": {
"type": "object",
"properties": {
"type": {
"type": "string",
"nullable": true
},
"title": {
"type": "string",
"nullable": true
},
"status": {
"type": "integer",
"format": "int32",
"nullable": true
},
"detail": {
"type": "string",
"nullable": true
},
"instance": {
"type": "string",
"nullable": true
}
}
}
}
}
}
},
"x-aspnetcore-id": "4a6c99a0-b364-4ac4-80ef-96296b49d42b"
}
}
},
"tags": [
{
"name": "BechdelApi"
},
{
"name": "BechdelDataServer"
}
]
}
Expected Behavior
Should include schemas.
Steps To Reproduce
https://github.com/shawnwildermuth/BechdelDataServer/tree/issue/missingschemas
Exceptions (if any)
None.
.NET Version
9.0.100-preview.5.24307.3
Anything else?
.NET SDK:
Version: 9.0.100-preview.5.24307.3
Commit: 35b2c21ea6
Workload version: 9.0.100-manifests.6407b7e4
MSBuild version: 17.11.0-preview-24279-02+b963c24ef
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.100-preview.5.24307.3\
.NET workloads installed:
Configured to use loose manifests when installing new manifests.
[aspire]
Installation Source: VS 17.10.35013.160, VS 17.11.35017.193
Manifest Version: 9.0.0-preview.2.24163.9/9.0.100-preview.1
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100-preview.1\microsoft.net.sdk.aspire\9.0.0-preview.2.24163.9\WorkloadManifest.json
Install Type: Msi
[ios]
Installation Source: VS 17.10.35013.160
Manifest Version: 17.2.9088-net9-p1/9.0.100-preview.1
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100-preview.1\microsoft.net.sdk.ios\17.2.9088-net9-p1\WorkloadManifest.json
Install Type: Msi
[maccatalyst]
Installation Source: VS 17.10.35013.160
Manifest Version: 17.2.9088-net9-p1/9.0.100-preview.1
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100-preview.1\microsoft.net.sdk.maccatalyst\17.2.9088-net9-p1\WorkloadManifest.json
Install Type: Msi
[android]
Installation Source: VS 17.10.35013.160
Manifest Version: 34.99.0-preview.1.151/9.0.100-preview.1
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100-preview.1\microsoft.net.sdk.android\34.99.0-preview.1.151\WorkloadManifest.json
Install Type: Msi
[maui-windows]
Installation Source: VS 17.10.35013.160
Manifest Version: 9.0.0-preview.1.9973/9.0.100-preview.1
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100-preview.1\microsoft.net.sdk.maui\9.0.0-preview.1.9973\WorkloadManifest.json
Install Type: Msi
Host:
Version: 9.0.0-preview.5.24306.7
Architecture: x64
Commit: a5cc707d97
.NET SDKs installed:
5.0.408 [C:\Program Files\dotnet\sdk]
6.0.423 [C:\Program Files\dotnet\sdk]
7.0.410 [C:\Program Files\dotnet\sdk]
8.0.206 [C:\Program Files\dotnet\sdk]
8.0.300 [C:\Program Files\dotnet\sdk]
8.0.301 [C:\Program Files\dotnet\sdk]
8.0.302 [C:\Program Files\dotnet\sdk]
9.0.100-preview.5.24307.3 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.31 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0-preview.5.24306.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.31 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0-preview.5.24306.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.31 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.0-preview.5.24306.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download