diff --git a/changelog.md b/changelog.md index 85d30f9..7891a4a 100644 --- a/changelog.md +++ b/changelog.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ---- ## [Unreleased] +### Added + +* `newMethod()` now includes a `deprecated` flag on the operation template, defaulting to `false`, so generated operation objects declare the standard OpenAPI `deprecated` field. ## [3.0.0] => 2024-MAY-30 ### Fixed diff --git a/models/OpenAPI/Util.cfc b/models/OpenAPI/Util.cfc index 5ddd0f5..cec8307 100644 --- a/models/OpenAPI/Util.cfc +++ b/models/OpenAPI/Util.cfc @@ -60,6 +60,7 @@ component name="OpenAPIUtil" accessors="true" { { "tags" : [] }, { "description" : "" }, { "operationId" : "" }, + { "deprecated" : false }, { "parameters" : [] }, { "responses" : { "default" : descMap } } ]; diff --git a/test-harness/tests/specs/DocumentSpec.cfc b/test-harness/tests/specs/DocumentSpec.cfc index cd4a614..ef45e20 100644 --- a/test-harness/tests/specs/DocumentSpec.cfc +++ b/test-harness/tests/specs/DocumentSpec.cfc @@ -58,6 +58,16 @@ component extends="tests.resources.BaseOpenAPISpec" { } ); } ); + describe( "Operation template tests", function(){ + it( "Tests that newMethod() includes a deprecated flag defaulting to false", function(){ + var method = getInstance( "OpenAPIUtil@SwaggerSDK" ).newMethod(); + + expect( method ).toBeStruct().toHaveKey( "deprecated" ); + expect( method[ "deprecated" ] ).toBeBoolean(); + expect( method[ "deprecated" ] ).toBeFalse(); + } ); + } ); + describe( "Core functionality tests", function(){ it( "Tests that an attempt to locate an invalid path with return a $ref object", function(){ var DocumentObject = getInstance( "OpenAPIDocument@SwaggerSDK" ).init( VARIABLES.testDocument );