39 lines
1.6 KiB
Plaintext
39 lines
1.6 KiB
Plaintext
# ===------------------------------------------------------------------------------------===
|
|||
|
|
#
|
||
|
|
# This source file is part of the App Store Connect Service open source project
|
||
|
|
#
|
||
|
|
# Copyright (c) 2026 Röck+Cöde VoF. and the App Store Connect Service project authors
|
||
|
|
# Licensed under Apache license v2.0
|
||
|
|
#
|
||
|
|
# See LICENSE for license information
|
||
|
|
# See CONTRIBUTORS for the list of App Store Connect Service project authors
|
||
|
|
#
|
||
|
|
# SPDX-License-Identifier: Apache-2.0
|
||
|
|
#
|
||
|
|
# ===------------------------------------------------------------------------------------===
|
||
|
|
|
||
|
|
# Patches the App Store Connect OpenAPI specification document. Each patch is safe to apply more than once.
|
||
|
|
|
||
|
|
# Removes empty enums (e.g. `fields[appKeywords]`), as they generate case-less Swift enums that do not compile.
|
||
|
|
(.. | objects | select(.enum == [])) |= del(.enum)
|
||
|
|
|
||
|
|
# Adds the undocumented `cursor` query parameter, used by `next` links, to the operations that return paged responses.
|
||
|
|
| ([
|
||
|
|
.components.schemas
|
||
|
|
| to_entries[]
|
||
|
|
| select(.value.properties.links["$ref"] == "#/components/schemas/PagedDocumentLinks")
|
||
|
|
| "#/components/schemas/" + .key
|
||
|
|
]) as $paged
|
||
|
|
| .paths[][] |= (
|
||
|
|
if type == "object"
|
||
|
|
and (.responses["200"].content["application/json"].schema["$ref"] as $ref | any($paged[]; . == $ref))
|
||
|
|
and (any(.parameters[]?; .name == "cursor") | not)
|
||
|
|
then .parameters += [{
|
||
|
|
"name": "cursor",
|
||
|
|
"in": "query",
|
||
|
|
"description": "cursor of the page to fetch, from the next link of the previous page",
|
||
|
|
"schema": { "type": "string" },
|
||
|
|
"style": "form"
|
||
|
|
}]
|
||
|
|
else . end
|
||
|
|
)
|