mirror of
https://github.com/xtool-org/xtool.git
synced 2026-11-16 20:41:53 +03:00
format.js
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import fs from 'fs';
|
||||
|
||||
function format(schema) {
|
||||
// this field is required when using the private Xcode API
|
||||
const capabilityCreateRelationships = schema.components.schemas.BundleIdCapabilityCreateRequest.properties.data.properties.relationships;
|
||||
capabilityCreateRelationships.properties.capability = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
data: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
type: {
|
||||
type: 'string',
|
||||
enum: ['capabilities'],
|
||||
},
|
||||
id: { $ref: '#/components/schemas/CapabilityType' },
|
||||
},
|
||||
required: ['id', 'type'],
|
||||
},
|
||||
},
|
||||
required: ['data'],
|
||||
}
|
||||
capabilityCreateRelationships.required.push('capability');
|
||||
|
||||
// we don't use this but it triggers a deprecation warning. see:
|
||||
// https://github.com/apple/swift-openapi-generator/issues/715
|
||||
schema.components.schemas.App.properties.relationships.properties.inAppPurchases.deprecated = false;
|
||||
|
||||
return schema;
|
||||
}
|
||||
|
||||
const text = fs.readFileSync(process.stdin.fd, 'utf8');
|
||||
const json = JSON.parse(text);
|
||||
const formatted = format(json);
|
||||
const formattedText = JSON.stringify(formatted);
|
||||
console.log(formattedText);
|
||||
@@ -3,29 +3,6 @@ info:
|
||||
title: Overlay for App Store Connect API
|
||||
version: 1.0.0
|
||||
actions:
|
||||
# this field is required when using the private Xcode API
|
||||
- target: '$.components.schemas.BundleIdCapabilityCreateRequest.properties.data.properties.relationships'
|
||||
update:
|
||||
properties:
|
||||
capability:
|
||||
type: object
|
||||
properties:
|
||||
data:
|
||||
type: object
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum: [capabilities]
|
||||
id:
|
||||
"$ref": "#/components/schemas/CapabilityType"
|
||||
required: [id, type]
|
||||
required: [data]
|
||||
required: [capability]
|
||||
# we don't use this but it triggers a deprecation warning. see:
|
||||
# https://github.com/apple/swift-openapi-generator/issues/715
|
||||
- target: '$.components.schemas.App.properties.relationships.properties.inAppPurchases'
|
||||
update:
|
||||
deprecated: false
|
||||
# openapi-generator expects response enums to be exhaustive. Apple's ASC OpenAPI spec
|
||||
# misses some cases that they do, actually, return.
|
||||
- target: '$.components.schemas.Device.properties.attributes.properties.deviceClass'
|
||||
|
||||
Reference in New Issue
Block a user