Skip to content

Commit

Permalink
Remove patch for FB13540097 (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
MortenGregersen authored Jun 13, 2024
1 parent 21fe7de commit 29558e2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 190 deletions.
17 changes: 4 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,19 +166,6 @@ On 12/1/23 some errors (with status code 409) has been observed, with no `detail
In Apple's OpenAPI spec and documentation the `associatedErrors` is not mentioned in `meta` property (last checked 12/1/23).
But it is observed when creating a `ReviewSubmissionItem` with an `AppStoreVersion` fails.

#### **FB13540097**: Almost all of the schemas ending in “WithoutIncludesResponse” has wrong "data" type

* Submitted: January 14th 2024.
* Confirmed by Apple: January 31st 2024

**Title:** App Store Connect API Spec and Docs has wrong schema ref for the "data" property on almost all of the schemas ending in “WithoutIncludesResponse”

##### Description

Almost all of the schemas ending in “WithoutIncludesResponse” has a wrong schema ref for the “data” property. This is both the case in the OpenAPI Spec and the Docs on developer.apple.com.

As an example, the data property of “BetaTestersWithoutIncludesResponse” refer to the schema “Build”, but when I do a request to the “/v1/betaGroups/{id}/betaTesters” endpoint, all of the items in the “data” of the JSON is of type “BetaTester”. The docs says the same: https://developer.apple.com/documentation/appstoreconnectapi/BetaTestersWithoutIncludesResponse

#### **FB13701181**: App Store Connect API Spec is missing "DEVELOPER_ID_APPLICATION_G2" type for the Certificate Type schema

* Submitted: March 28th 2024.
Expand All @@ -189,6 +176,10 @@ When creating certificates on [the developer portal](https://developer.apple.com
### Closed feedback (removed patches)
* **FB13540097**: Almost all of the schemas ending in “WithoutIncludesResponse” has wrong "data" type
* Submitted: January 14th 2024.
* Resolved: July 11th 2024 (Spec version 3.5).
* **FB9963088**: The xcodeMetrics schema has no properties or attributes in the OpenAPI spec
* Submitted: March 21st 2022.
* Resolved: July 12th 2022 (Spec version 2.0).
Expand Down
20 changes: 0 additions & 20 deletions Sources/BagbutikSpecDecoder/Spec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -194,26 +194,6 @@ public struct Spec: Decodable {
patchedSchemas.append(.enum(certificateTypeSchema))
}

// Change the shcema ref of the `data` property on *WithoutIncludesResponse
// Apple's OpenAPI spec and docs almost all the respones have wrong schema ref. Reported to Apple 14/1/24 as FB13540097.
components.schemas.keys
.filter { $0.hasSuffix("WithoutIncludesResponse") }
.filter { $0 != "AppCategoriesWithoutIncludesResponse" && $0 != "AppCategoryWithoutIncludesResponse" }
.forEach { schemaName in
let schemaRefName = schemaName
.replacingOccurrences(of: "WithoutIncludesResponse", with: "")
.replacingOccurrences(of: "PreRelease", with: "Prerelease")
if case .object(var responseSchema) = components.schemas[schemaName] {
if schemaRefName.hasSuffix("s") {
responseSchema.properties["data"]?.type = .arrayOfSchemaRef(schemaRefName.singularized())
} else {
responseSchema.properties["data"]?.type = .schemaRef(schemaRefName)
}
components.schemas[schemaName] = .object(responseSchema)
patchedSchemas.append(.object(responseSchema))
}
}

// Fix up the names of the sub schemas of ErrorResponse.Errors
guard case .object(var errorResponseSchema) = components.schemas["ErrorResponse"],
let errorsProperty = errorResponseSchema.properties["errors"],
Expand Down
158 changes: 1 addition & 157 deletions Tests/BagbutikSpecDecoderTests/SpecTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -885,163 +885,7 @@ final class SpecTests: XCTestCase {
}
XCTAssertEqual(errorSchemaRef, "Errors")
}

func testApplyManualPatches_WithoutIncludes() throws {
let specString = """
{
"paths": {},
"components": {
"schemas": {
"ErrorResponse" : {
"type" : "object",
"properties" : {
"errors" : {
"type" : "array",
"items" : {
"type" : "object",
"properties" : {
"id" : {
"type" : "string"
},
"status" : {
"type" : "string"
},
"code" : {
"type" : "string"
},
"title" : {
"type" : "string"
},
"detail" : {
"type" : "string"
},
"source" : {
"oneOf" : [ {
"$ref" : "#/components/schemas/ErrorSourcePointer"
}, {
"$ref" : "#/components/schemas/ErrorSourceParameter"
} ]
}
},
"required" : [ "code", "detail", "title", "status" ]
}
}
}
},
"AppWithoutIncludesResponse" : {
"type" : "object",
"title" : "AppWithoutIncludesResponse",
"properties" : {
"data" : {
"$ref" : "#/components/schemas/PrereleaseVersion"
},
"links" : {
"$ref" : "#/components/schemas/DocumentLinks"
}
},
"required" : [ "data", "links" ]
},
"AppsWithoutIncludesResponse" : {
"type" : "object",
"title" : "AppsWithoutIncludesResponse",
"properties" : {
"data" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/User"
}
},
"links" : {
"$ref" : "#/components/schemas/PagedDocumentLinks"
},
"meta" : {
"$ref" : "#/components/schemas/PagingInformation"
}
},
"required" : [ "data", "links" ]
},
"AppCategoriesWithoutIncludesResponse" : {
"type" : "object",
"title" : "AppCategoriesWithoutIncludesResponse",
"properties" : {
"data" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/AppCategory"
}
},
"links" : {
"$ref" : "#/components/schemas/PagedDocumentLinks"
},
"meta" : {
"$ref" : "#/components/schemas/PagingInformation"
}
},
"required" : [ "data", "links" ]
},
"PreReleaseVersionsWithoutIncludesResponse" : {
"type" : "object",
"title" : "PreReleaseVersionsWithoutIncludesResponse",
"properties" : {
"data" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/App"
}
},
"links" : {
"$ref" : "#/components/schemas/PagedDocumentLinks"
},
"meta" : {
"$ref" : "#/components/schemas/PagingInformation"
}
},
"required" : [ "data", "links" ]
},
"CertificateType" : {
"type" : "string",
"enum" : [ "DISTRIBUTION", "DEVELOPMENT", "DEVELOPER_ID_APPLICATION" ]
}
}
}
}
"""
let jsonDecoder = JSONDecoder()
var spec = try jsonDecoder.decode(Spec.self, from: specString.data(using: .utf8)!)
try spec.applyManualPatches()

guard case .object(let responseSchema) = spec.components.schemas["AppWithoutIncludesResponse"],
case .schemaRef(let responseSchemaDataRef) = responseSchema.properties["data"]?.type else {
XCTFail(); return
}
XCTAssertEqual(responseSchemaDataRef, "App")

guard case .object(let responseSchema) = spec.components.schemas["AppsWithoutIncludesResponse"],
case .arrayOfSchemaRef(let responseSchemaDataRef) = responseSchema.properties["data"]?.type else {
XCTFail(); return
}
XCTAssertEqual(responseSchemaDataRef, "App")

guard case .object(let responseSchema) = spec.components.schemas["AppCategoriesWithoutIncludesResponse"],
case .arrayOfSchemaRef(let responseSchemaDataRef) = responseSchema.properties["data"]?.type else {
XCTFail(); return
}
XCTAssertEqual(responseSchemaDataRef, "AppCategory")

guard case .object(let responseSchema) = spec.components.schemas["PreReleaseVersionsWithoutIncludesResponse"],
case .arrayOfSchemaRef(let responseSchemaDataRef) = responseSchema.properties["data"]?.type else {
XCTFail(); return
}
XCTAssertEqual(responseSchemaDataRef, "PrereleaseVersion")

guard case .enum(let certificateTypeSchema) = spec.components.schemas["CertificateType"] else {
XCTFail(); return
}
let certificateTypeCaseValues = certificateTypeSchema.cases.map(\.value)
XCTAssertEqual(certificateTypeCaseValues.count, 4)
XCTAssertTrue(certificateTypeCaseValues.contains("DEVELOPER_ID_APPLICATION_G2"))
}


func testApplyManualPatches_Error() throws {
let specString = """
{
Expand Down

0 comments on commit 29558e2

Please sign in to comment.