diff --git a/test/Swashbuckle.AspNetCore.Cli.Test/ToolTests.cs b/test/Swashbuckle.AspNetCore.Cli.Test/ToolTests.cs index 3906c388ae..cc6598009a 100644 --- a/test/Swashbuckle.AspNetCore.Cli.Test/ToolTests.cs +++ b/test/Swashbuckle.AspNetCore.Cli.Test/ToolTests.cs @@ -28,7 +28,7 @@ public void Can_Generate_Swagger_Json() Assert.True(productsPath.TryGetProperty("post", out _)); } - [Fact(Skip = "Disabled because it makes CI unstable")] + [Fact] public void Overwrites_Existing_File() { using var temporaryDirectory = new TemporaryDirectory(); diff --git a/test/Swashbuckle.AspNetCore.IntegrationTests/SwaggerIntegrationTests.cs b/test/Swashbuckle.AspNetCore.IntegrationTests/SwaggerIntegrationTests.cs index 386a5715af..eb2fcfcc6a 100644 --- a/test/Swashbuckle.AspNetCore.IntegrationTests/SwaggerIntegrationTests.cs +++ b/test/Swashbuckle.AspNetCore.IntegrationTests/SwaggerIntegrationTests.cs @@ -20,7 +20,7 @@ public class SwaggerIntegrationTests { [Theory] [InlineData(typeof(Basic.Startup), "/swagger/v1/swagger.json")] - [InlineData(typeof(CliExample.Startup), "/swagger/v1/swagger.json")] + [InlineData(typeof(CliExample.Startup), "/swagger/v1/swagger_net8.0.json")] [InlineData(typeof(ConfigFromFile.Startup), "/swagger/v1/swagger.json")] [InlineData(typeof(CustomUIConfig.Startup), "/swagger/v1/swagger.json")] [InlineData(typeof(CustomUIIndex.Startup), "/swagger/v1/swagger.json")] diff --git a/test/WebSites/CliExample/CliExample.csproj b/test/WebSites/CliExample/CliExample.csproj index 20d3de5abd..59092cc3b7 100644 --- a/test/WebSites/CliExample/CliExample.csproj +++ b/test/WebSites/CliExample/CliExample.csproj @@ -28,7 +28,7 @@ --> - diff --git a/test/WebSites/CliExample/wwwroot/swagger/v1/swagger.json b/test/WebSites/CliExample/wwwroot/swagger/v1/swagger_net6.0.json similarity index 99% rename from test/WebSites/CliExample/wwwroot/swagger/v1/swagger.json rename to test/WebSites/CliExample/wwwroot/swagger/v1/swagger_net6.0.json index 95aa261dd6..0e1dee7edd 100644 --- a/test/WebSites/CliExample/wwwroot/swagger/v1/swagger.json +++ b/test/WebSites/CliExample/wwwroot/swagger/v1/swagger_net6.0.json @@ -51,4 +51,4 @@ } } } -} +} \ No newline at end of file diff --git a/test/WebSites/CliExample/wwwroot/swagger/v1/swagger_net7.0.json b/test/WebSites/CliExample/wwwroot/swagger/v1/swagger_net7.0.json new file mode 100644 index 0000000000..0e1dee7edd --- /dev/null +++ b/test/WebSites/CliExample/wwwroot/swagger/v1/swagger_net7.0.json @@ -0,0 +1,54 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "CliExample", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost:51071" + } + ], + "paths": { + "/products": { + "get": { + "tags": [ + "Products" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Product" + } + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Product": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "description": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/WebSites/CliExample/wwwroot/swagger/v1/swagger_net8.0.json b/test/WebSites/CliExample/wwwroot/swagger/v1/swagger_net8.0.json new file mode 100644 index 0000000000..0e1dee7edd --- /dev/null +++ b/test/WebSites/CliExample/wwwroot/swagger/v1/swagger_net8.0.json @@ -0,0 +1,54 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "CliExample", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost:51071" + } + ], + "paths": { + "/products": { + "get": { + "tags": [ + "Products" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Product" + } + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Product": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "description": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/WebSites/CliExampleWithFactory/CliExampleWithFactory.csproj b/test/WebSites/CliExampleWithFactory/CliExampleWithFactory.csproj index 48549a7fe7..154b9d9f30 100644 --- a/test/WebSites/CliExampleWithFactory/CliExampleWithFactory.csproj +++ b/test/WebSites/CliExampleWithFactory/CliExampleWithFactory.csproj @@ -32,7 +32,7 @@ --> - diff --git a/test/WebSites/CliExampleWithFactory/wwwroot/swagger/v1/swagger.json b/test/WebSites/CliExampleWithFactory/wwwroot/swagger/v1/swagger_net6.0.json similarity index 99% rename from test/WebSites/CliExampleWithFactory/wwwroot/swagger/v1/swagger.json rename to test/WebSites/CliExampleWithFactory/wwwroot/swagger/v1/swagger_net6.0.json index eb21965c49..2778aed45a 100644 --- a/test/WebSites/CliExampleWithFactory/wwwroot/swagger/v1/swagger.json +++ b/test/WebSites/CliExampleWithFactory/wwwroot/swagger/v1/swagger_net6.0.json @@ -51,4 +51,4 @@ } } } -} +} \ No newline at end of file diff --git a/test/WebSites/CliExampleWithFactory/wwwroot/swagger/v1/swagger_net7.0.json b/test/WebSites/CliExampleWithFactory/wwwroot/swagger/v1/swagger_net7.0.json new file mode 100644 index 0000000000..2778aed45a --- /dev/null +++ b/test/WebSites/CliExampleWithFactory/wwwroot/swagger/v1/swagger_net7.0.json @@ -0,0 +1,54 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "CliExampleWithFactory", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost:57556/" + } + ], + "paths": { + "/products": { + "get": { + "tags": [ + "Products" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Product" + } + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Product": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "description": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/WebSites/CliExampleWithFactory/wwwroot/swagger/v1/swagger_net8.0.json b/test/WebSites/CliExampleWithFactory/wwwroot/swagger/v1/swagger_net8.0.json new file mode 100644 index 0000000000..2778aed45a --- /dev/null +++ b/test/WebSites/CliExampleWithFactory/wwwroot/swagger/v1/swagger_net8.0.json @@ -0,0 +1,54 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "CliExampleWithFactory", + "version": "1.0" + }, + "servers": [ + { + "url": "http://localhost:57556/" + } + ], + "paths": { + "/products": { + "get": { + "tags": [ + "Products" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Product" + } + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Product": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int32" + }, + "description": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + } + } +} \ No newline at end of file diff --git a/test/WebSites/NswagClientExample/NswagClientExample.csproj b/test/WebSites/NswagClientExample/NswagClientExample.csproj index 6b6ea3dea4..4ee15c17f8 100644 --- a/test/WebSites/NswagClientExample/NswagClientExample.csproj +++ b/test/WebSites/NswagClientExample/NswagClientExample.csproj @@ -25,12 +25,12 @@ - - + diff --git a/test/WebSites/NswagClientExample/swagger.json b/test/WebSites/NswagClientExample/swagger_net6.0.json similarity index 99% rename from test/WebSites/NswagClientExample/swagger.json rename to test/WebSites/NswagClientExample/swagger_net6.0.json index 824dd5bc62..68e90e3375 100644 --- a/test/WebSites/NswagClientExample/swagger.json +++ b/test/WebSites/NswagClientExample/swagger_net6.0.json @@ -137,4 +137,4 @@ } } } -} +} \ No newline at end of file diff --git a/test/WebSites/NswagClientExample/swagger_net8.0.json b/test/WebSites/NswagClientExample/swagger_net8.0.json new file mode 100644 index 0000000000..68e90e3375 --- /dev/null +++ b/test/WebSites/NswagClientExample/swagger_net8.0.json @@ -0,0 +1,140 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "NswagClientExample", + "version": "1.0" + }, + "servers": [ + { + "url": "http://example.com" + } + ], + "paths": { + "/Animals": { + "post": { + "tags": [ + "Animals" + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/Animal" + }, + { + "$ref": "#/components/schemas/Cat" + }, + { + "$ref": "#/components/schemas/Dog" + } + ] + } + }, + "text/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/Animal" + }, + { + "$ref": "#/components/schemas/Cat" + }, + { + "$ref": "#/components/schemas/Dog" + } + ] + } + }, + "application/*+json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/Animal" + }, + { + "$ref": "#/components/schemas/Cat" + }, + { + "$ref": "#/components/schemas/Dog" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "OK" + } + } + } + } + }, + "components": { + "schemas": { + "Animal": { + "required": [ + "animalType" + ], + "type": "object", + "properties": { + "animalType": { + "$ref": "#/components/schemas/AnimalType" + } + }, + "additionalProperties": false, + "discriminator": { + "propertyName": "animalType", + "mapping": { + "Cat": "#/components/schemas/Cat", + "Dog": "#/components/schemas/Dog" + } + } + }, + "AnimalType": { + "enum": [ + "Cat", + "Dog" + ], + "type": "string" + }, + "Cat": { + "allOf": [ + { + "$ref": "#/components/schemas/Animal" + }, + { + "type": "object", + "properties": { + "catSpecificProperty": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ] + }, + "Dog": { + "allOf": [ + { + "$ref": "#/components/schemas/Animal" + }, + { + "type": "object", + "properties": { + "dogSpecificProperty": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + ] + } + } + } +} \ No newline at end of file