Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
// Commented out: Lift endpoints removed (AUOpenBanking, Polish, STET)
//import code.api.AUOpenBanking.v1_0_0.ApiCollector
import code.api.Constant
//import code.api.Polish.v2_1_1_1.OBP_PAPI_2_1_1_1

Check warning on line 48 in obp-api/src/main/scala/code/api/ResourceDocs1_4_0/SwaggerJSONFactory.scala

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this commented out code.

See more on https://sonarcloud.io/project/issues?id=OpenBankProject_OBP-API&issues=AaGD35V8tqzpX64G6ciT&open=AaGD35V8tqzpX64G6ciT&pullRequest=2951
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON.{NotSupportedYet, notSupportedYet}
//import code.api.STET.v1_4.OBP_STET_1_4

Check warning on line 50 in obp-api/src/main/scala/code/api/ResourceDocs1_4_0/SwaggerJSONFactory.scala

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this commented out code.

See more on https://sonarcloud.io/project/issues?id=OpenBankProject_OBP-API&issues=AaGD35V8tqzpX64G6ciU&open=AaGD35V8tqzpX64G6ciU&pullRequest=2951
import code.api.UKOpenBanking.v2_0_0.OBP_UKOpenBanking_200
import code.api.UKOpenBanking.v3_1_0.OBP_UKOpenBanking_310
import code.api.UKOpenBanking.v4_0_1.OBP_UKOpenBanking_401
Expand Down Expand Up @@ -707,7 +707,13 @@
case _ => paramValue
}

val definition = buildSwaggerSchema(paramType, exampleValue)
// Name the entity and field, so an unusable example can be found from the message alone.
val definition =
try buildSwaggerSchema(paramType, exampleValue)
catch {
case e: RuntimeException =>
throw new RuntimeException(s"${entityType.typeSymbol.name}.$paramName: ${e.getMessage}", e)
}

s""" "$paramName": $definition """
})
Expand Down
3 changes: 2 additions & 1 deletion obp-api/src/main/scala/code/api/v7_0_0/Http4s700.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6989,7 +6989,8 @@ object Http4s700 {
payload_hash = "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
current_payload_hash = "",
proposed_payload = Extraction.decompose(jsonDynamicResourceDoc),
current_payload = JNothing,
// A CREATE has nothing to replace. The swagger export needs an object here, not JNothing.
current_payload = JObject(Nil),
requestor_user_id = code.api.util.ExampleValue.userIdExample.value,
business_justification = "Expose the new loan quote endpoint for the mobile app.",
checker_user_id = "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ class SwaggerDocsTest extends ResourceDocsV140ServerSetup with PropsReset with D
errors.isEmpty should be (true)
}

scenario(s"We will test ${ApiEndpoint1.name} Api - v7.0.0 swagger export succeeds", ApiEndpoint1, VersionOfApi) {
val requestGetSwagger = (ResourceDocsV5_1Request / "resource-docs" / "v7.0.0" / "swagger").GET
val responseGetSwagger = makeGetRequest(requestGetSwagger)
And("We should get 200, not OBP-50000 because one entity has no example")
withClue(responseGetSwagger.body.toString) {
responseGetSwagger.code should equal(200)
}
}

scenario(s"We will test ${ApiEndpoint1.name} Api - v4.0.0", ApiEndpoint1, VersionOfApi) {
val requestGetObp = (ResourceDocsV4_0Request / "resource-docs" / "v4.0.0" / "swagger").GET
val responseGetObp = makeGetRequest(requestGetObp)
Expand Down
Loading