Skip to content

Commit 6f8a0f1

Browse files
committed
Fixing schema for authentication issues in codegen (paypal#5)
1 parent 6c833d3 commit 6f8a0f1

20 files changed

+330
-494
lines changed

.github/workflows/ci.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ jobs:
2626
node-version: ${{ matrix.node-version }}
2727
cache: 'npm'
2828
- run: npm i
29-
- run: find openapi -name '*.json' -exec npm run-script bundle-deref -- {} \;
30-
- run: find openapi -name '*.json' -exec npm run-script lint-redocly -- {} \;
31-
- run: find openapi -name '*.json' -exec npm run-script lint-spectral -- {} \;
32-
- run: find openapi -name '*.json' -exec npm run-script lint-openapi -- {} \;
33-
- run: find openapi -name '*.json' -exec npm run-script codegen-java -- {} \; -exec rm -rf generated/java \;
34-
- run: find openapi -name '*.json' -exec npm run-script codegen-typescript-node -- {} \; -exec rm -rf generated/typescript-node \;
29+
- run: find openapi -name '*.json' -exec npm run bundle-deref -- {} \;
30+
- run: find openapi -name '*.json' -exec npm run lint-redocly -- {} \;
31+
- run: find openapi -name '*.json' -exec npm run lint-spectral -- {} \;
32+
- run: find openapi -name '*.json' -exec npm run lint-openapi -- {} \;
33+
- run: find openapi -name '*.json' -exec npm run codegen-java -- {} \; -exec rm -rf generated/java \;
34+
- run: find openapi -name '*.json' -exec npm run codegen-typescript-node -- {} \; -exec rm -rf generated/typescript-node \;

README.md

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
# PayPal REST API Specifications
22

3-
This repository contains the specification files for [PayPal's REST APIs](https://developer.paypal.com/api/rest/).
3+
This repository contains the specification files for [PayPal REST APIs](https://developer.paypal.com/api/rest/).
44

55
You can try our REST APIs in Postman without a PayPal Developer account. Learn more in our [Postman guide](https://developer.paypal.com/api/rest/postman/).
66

77
[![Run in Postman](https://run.pstmn.io/button.svg)](https://god.gw.postman.com/run-collection/19024122-92a85d0e-51e7-47da-9f83-c45dcb1cdf24?action=collection%2Ffork&collection-url=entityId%3D19024122-92a85d0e-51e7-47da-9f83-c45dcb1cdf24%26entityType%3Dcollection%26workspaceId%3D345300e6-346e-42e0-aed1-53717919aef0)
88

9-
## Usage
9+
## Steps to generate code from the specification
1010

11-
Available scripts can be executed against the required API by using the following command:
12-
>`npm run-script <script_name> -- <path_to_required_api> [<additional_script_arguments>]`
11+
> _Note: Spec file used: openapi/checkout_orders_v2.json_
1312
14-
Example:
15-
> `npm run-script codegen-java -- openapi/checkout_orders_v2.json`
13+
### Java
14+
1. `npm run codegen-java -- openapi/checkout_orders_v2.json --artifact-id orders`
15+
2. `cd generated/java`
16+
3. `mvn clean install`
17+
18+
The above will install the `orders` artifact to the local maven repository
19+
20+
## Available scripts
1621

1722
```
1823
npm run

openapi/billing_subscriptions_v1.json

+24-75
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"openapi": "3.0.0",
2+
"openapi": "3.0.3",
33
"info": {
44
"title": "Subscriptions",
55
"description": "You can use billing plans and subscriptions to create subscriptions that process recurring PayPal payments for physical or digital goods, or services. A plan includes pricing and billing cycle information that defines the amount and frequency of charge for a subscription. You can also define a fixed plan, such as a $5 basic plan or a volume- or graduated-based plan with pricing tiers based on the quantity purchased. For more information, see <a href=\"/docs/subscriptions/\">Subscriptions Overview</a>.",
66
"version": "1.6"
77
},
88
"paths": {
9-
"/plans": {
9+
"/v1/billing/plans": {
1010
"post": {
1111
"summary": "Create plan",
1212
"description": "Creates a plan that defines pricing and billing cycle details for subscriptions.",
@@ -120,9 +120,6 @@
120120
}
121121
},
122122
"parameters": [
123-
{
124-
"$ref": "#/components/parameters/authorization"
125-
},
126123
{
127124
"$ref": "#/components/parameters/content_type"
128125
},
@@ -249,9 +246,6 @@
249246
}
250247
},
251248
"parameters": [
252-
{
253-
"$ref": "#/components/parameters/authorization"
254-
},
255249
{
256250
"$ref": "#/components/parameters/content_type"
257251
},
@@ -289,7 +283,7 @@
289283
]
290284
}
291285
},
292-
"/plans/{id}": {
286+
"/v1/billing/plans/{id}": {
293287
"get": {
294288
"summary": "Show plan details",
295289
"description": "Shows details for a plan, by ID.",
@@ -371,9 +365,6 @@
371365
}
372366
},
373367
"parameters": [
374-
{
375-
"$ref": "#/components/parameters/authorization"
376-
},
377368
{
378369
"$ref": "#/components/parameters/content_type"
379370
},
@@ -503,9 +494,6 @@
503494
}
504495
},
505496
"parameters": [
506-
{
507-
"$ref": "#/components/parameters/authorization"
508-
},
509497
{
510498
"$ref": "#/components/parameters/content_type"
511499
},
@@ -528,7 +516,7 @@
528516
]
529517
}
530518
},
531-
"/plans/{id}/activate": {
519+
"/v1/billing/plans/{id}/activate": {
532520
"post": {
533521
"summary": "Activate plan",
534522
"description": "Activates a plan, by ID.",
@@ -620,9 +608,6 @@
620608
}
621609
},
622610
"parameters": [
623-
{
624-
"$ref": "#/components/parameters/authorization"
625-
},
626611
{
627612
"$ref": "#/components/parameters/content_type"
628613
},
@@ -642,7 +627,7 @@
642627
]
643628
}
644629
},
645-
"/plans/{id}/deactivate": {
630+
"/v1/billing/plans/{id}/deactivate": {
646631
"post": {
647632
"summary": "Deactivate plan",
648633
"description": "Deactivates a plan, by ID.",
@@ -734,9 +719,6 @@
734719
}
735720
},
736721
"parameters": [
737-
{
738-
"$ref": "#/components/parameters/authorization"
739-
},
740722
{
741723
"$ref": "#/components/parameters/content_type"
742724
},
@@ -756,7 +738,7 @@
756738
]
757739
}
758740
},
759-
"/plans/{id}/update-pricing-schemes": {
741+
"/v1/billing/plans/{id}/update-pricing-schemes": {
760742
"post": {
761743
"summary": "Update pricing",
762744
"description": "Updates pricing for a plan. For example, you can update a regular billing cycle from $5 per month to $7 per month.",
@@ -865,9 +847,6 @@
865847
}
866848
},
867849
"parameters": [
868-
{
869-
"$ref": "#/components/parameters/authorization"
870-
},
871850
{
872851
"$ref": "#/components/parameters/content_type"
873852
},
@@ -901,7 +880,7 @@
901880
]
902881
}
903882
},
904-
"/subscriptions": {
883+
"/v1/billing/subscriptions": {
905884
"post": {
906885
"summary": "Create subscription",
907886
"description": "Creates a subscription.",
@@ -1020,9 +999,6 @@
1020999
}
10211000
},
10221001
"parameters": [
1023-
{
1024-
"$ref": "#/components/parameters/authorization"
1025-
},
10261002
{
10271003
"$ref": "#/components/parameters/content_type"
10281004
},
@@ -1059,7 +1035,7 @@
10591035
]
10601036
}
10611037
},
1062-
"/subscriptions/{id}": {
1038+
"/v1/billing/subscriptions/{id}": {
10631039
"get": {
10641040
"summary": "Show subscription details",
10651041
"description": "Shows details for a subscription, by ID.",
@@ -1141,9 +1117,6 @@
11411117
}
11421118
},
11431119
"parameters": [
1144-
{
1145-
"$ref": "#/components/parameters/authorization"
1146-
},
11471120
{
11481121
"$ref": "#/components/parameters/content_type"
11491122
},
@@ -1273,9 +1246,6 @@
12731246
}
12741247
},
12751248
"parameters": [
1276-
{
1277-
"$ref": "#/components/parameters/authorization"
1278-
},
12791249
{
12801250
"$ref": "#/components/parameters/content_type"
12811251
},
@@ -1298,7 +1268,7 @@
12981268
]
12991269
}
13001270
},
1301-
"/subscriptions/{id}/revise": {
1271+
"/v1/billing/subscriptions/{id}/revise": {
13021272
"post": {
13031273
"summary": "Revise plan or quantity of subscription",
13041274
"description": "Updates the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the `shipping_amount`, `shipping_address` values for the subscription. This type of update requires the buyer's consent.",
@@ -1419,9 +1389,6 @@
14191389
}
14201390
},
14211391
"parameters": [
1422-
{
1423-
"$ref": "#/components/parameters/authorization"
1424-
},
14251392
{
14261393
"$ref": "#/components/parameters/content_type"
14271394
},
@@ -1455,7 +1422,7 @@
14551422
]
14561423
}
14571424
},
1458-
"/subscriptions/{id}/suspend": {
1425+
"/v1/billing/subscriptions/{id}/suspend": {
14591426
"post": {
14601427
"summary": "Suspend subscription",
14611428
"description": "Suspends the subscription.",
@@ -1564,9 +1531,6 @@
15641531
}
15651532
},
15661533
"parameters": [
1567-
{
1568-
"$ref": "#/components/parameters/authorization"
1569-
},
15701534
{
15711535
"$ref": "#/components/parameters/content_type"
15721536
},
@@ -1600,7 +1564,7 @@
16001564
]
16011565
}
16021566
},
1603-
"/subscriptions/{id}/cancel": {
1567+
"/v1/billing/subscriptions/{id}/cancel": {
16041568
"post": {
16051569
"summary": "Cancel subscription",
16061570
"description": "Cancels the subscription.",
@@ -1709,9 +1673,6 @@
17091673
}
17101674
},
17111675
"parameters": [
1712-
{
1713-
"$ref": "#/components/parameters/authorization"
1714-
},
17151676
{
17161677
"$ref": "#/components/parameters/content_type"
17171678
},
@@ -1745,7 +1706,7 @@
17451706
]
17461707
}
17471708
},
1748-
"/subscriptions/{id}/activate": {
1709+
"/v1/billing/subscriptions/{id}/activate": {
17491710
"post": {
17501711
"summary": "Activate subscription",
17511712
"description": "Activates the subscription.",
@@ -1854,9 +1815,6 @@
18541815
}
18551816
},
18561817
"parameters": [
1857-
{
1858-
"$ref": "#/components/parameters/authorization"
1859-
},
18601818
{
18611819
"$ref": "#/components/parameters/content_type"
18621820
},
@@ -1890,7 +1848,7 @@
18901848
]
18911849
}
18921850
},
1893-
"/subscriptions/{id}/capture": {
1851+
"/v1/billing/subscriptions/{id}/capture": {
18941852
"post": {
18951853
"summary": "Capture authorized payment on subscription",
18961854
"description": "Captures an authorized payment from the subscriber on the subscription.",
@@ -2009,9 +1967,6 @@
20091967
}
20101968
},
20111969
"parameters": [
2012-
{
2013-
"$ref": "#/components/parameters/authorization"
2014-
},
20151970
{
20161971
"$ref": "#/components/parameters/content_type"
20171972
},
@@ -2048,7 +2003,7 @@
20482003
]
20492004
}
20502005
},
2051-
"/subscriptions/{id}/transactions": {
2006+
"/v1/billing/subscriptions/{id}/transactions": {
20522007
"get": {
20532008
"summary": "List transactions for subscription",
20542009
"description": "Lists transactions for a subscription.",
@@ -2147,9 +2102,6 @@
21472102
}
21482103
},
21492104
"parameters": [
2150-
{
2151-
"$ref": "#/components/parameters/authorization"
2152-
},
21532105
{
21542106
"$ref": "#/components/parameters/content_type"
21552107
},
@@ -2187,11 +2139,16 @@
21872139
}
21882140
],
21892141
"externalDocs": {
2190-
"url": "../doc/USERGUIDE.md"
2142+
"url": "https://developer.paypal.com/docs/api/subscriptions/v1/"
21912143
},
21922144
"servers": [
21932145
{
2194-
"url": "https://api-m.paypal.com/v1/billing"
2146+
"url": "https://api-m.sandbox.paypal.com",
2147+
"description": "PayPal Sandbox Environment"
2148+
},
2149+
{
2150+
"url": "https://api-m.paypal.com",
2151+
"description": "PayPal Live Environment"
21952152
}
21962153
],
21972154
"components": {
@@ -2217,7 +2174,7 @@
22172174
"description": "Oauth 2.0 authentication",
22182175
"flows": {
22192176
"clientCredentials": {
2220-
"tokenUrl": "https://api-m.paypal.com/v1/oauth2/token",
2177+
"tokenUrl": "/v1/oauth2/token",
22212178
"scopes": {
22222179
"https://uri.paypal.com/services/subscriptions": "Manage plan & subscription"
22232180
}
@@ -2226,22 +2183,14 @@
22262183
}
22272184
},
22282185
"parameters": {
2229-
"authorization": {
2230-
"name": "Authorization",
2231-
"in": "header",
2232-
"description": "To make REST API calls, include the bearer token in the <code>Authorization</code> header with the <code>Bearer</code> authentication scheme. The value is <code>Bearer &lt;Access-Token&gt;</code> or <code>Basic &lt;client_id&gt;:&lt;secret&gt;</code>.",
2233-
"required": true,
2234-
"schema": {
2235-
"type": "string"
2236-
}
2237-
},
22382186
"content_type": {
22392187
"name": "Content-Type",
22402188
"in": "header",
22412189
"description": "The media type. Required for operations with a request body. The value is `application/<format>`, where the `format` is `json`.",
22422190
"required": true,
22432191
"schema": {
2244-
"type": "string"
2192+
"type": "string",
2193+
"default": "application/json"
22452194
}
22462195
},
22472196
"prefer": {

0 commit comments

Comments
 (0)