Skip to content

Commit

Permalink
Fixing schema for authentication issues in codegen (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
supremar committed Aug 12, 2023
1 parent 6c833d3 commit 6f8a0f1
Show file tree
Hide file tree
Showing 20 changed files with 330 additions and 494 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm i
- run: find openapi -name '*.json' -exec npm run-script bundle-deref -- {} \;
- run: find openapi -name '*.json' -exec npm run-script lint-redocly -- {} \;
- run: find openapi -name '*.json' -exec npm run-script lint-spectral -- {} \;
- run: find openapi -name '*.json' -exec npm run-script lint-openapi -- {} \;
- run: find openapi -name '*.json' -exec npm run-script codegen-java -- {} \; -exec rm -rf generated/java \;
- run: find openapi -name '*.json' -exec npm run-script codegen-typescript-node -- {} \; -exec rm -rf generated/typescript-node \;
- run: find openapi -name '*.json' -exec npm run bundle-deref -- {} \;
- run: find openapi -name '*.json' -exec npm run lint-redocly -- {} \;
- run: find openapi -name '*.json' -exec npm run lint-spectral -- {} \;
- run: find openapi -name '*.json' -exec npm run lint-openapi -- {} \;
- run: find openapi -name '*.json' -exec npm run codegen-java -- {} \; -exec rm -rf generated/java \;
- run: find openapi -name '*.json' -exec npm run codegen-typescript-node -- {} \; -exec rm -rf generated/typescript-node \;
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
# PayPal REST API Specifications

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

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/).

[![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)

## Usage
## Steps to generate code from the specification

Available scripts can be executed against the required API by using the following command:
>`npm run-script <script_name> -- <path_to_required_api> [<additional_script_arguments>]`
> _Note: Spec file used: openapi/checkout_orders_v2.json_
Example:
> `npm run-script codegen-java -- openapi/checkout_orders_v2.json`
### Java
1. `npm run codegen-java -- openapi/checkout_orders_v2.json --artifact-id orders`
2. `cd generated/java`
3. `mvn clean install`

The above will install the `orders` artifact to the local maven repository

## Available scripts

```
npm run
Expand Down
99 changes: 24 additions & 75 deletions openapi/billing_subscriptions_v1.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"openapi": "3.0.0",
"openapi": "3.0.3",
"info": {
"title": "Subscriptions",
"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>.",
"version": "1.6"
},
"paths": {
"/plans": {
"/v1/billing/plans": {
"post": {
"summary": "Create plan",
"description": "Creates a plan that defines pricing and billing cycle details for subscriptions.",
Expand Down Expand Up @@ -120,9 +120,6 @@
}
},
"parameters": [
{
"$ref": "#/components/parameters/authorization"
},
{
"$ref": "#/components/parameters/content_type"
},
Expand Down Expand Up @@ -249,9 +246,6 @@
}
},
"parameters": [
{
"$ref": "#/components/parameters/authorization"
},
{
"$ref": "#/components/parameters/content_type"
},
Expand Down Expand Up @@ -289,7 +283,7 @@
]
}
},
"/plans/{id}": {
"/v1/billing/plans/{id}": {
"get": {
"summary": "Show plan details",
"description": "Shows details for a plan, by ID.",
Expand Down Expand Up @@ -371,9 +365,6 @@
}
},
"parameters": [
{
"$ref": "#/components/parameters/authorization"
},
{
"$ref": "#/components/parameters/content_type"
},
Expand Down Expand Up @@ -503,9 +494,6 @@
}
},
"parameters": [
{
"$ref": "#/components/parameters/authorization"
},
{
"$ref": "#/components/parameters/content_type"
},
Expand All @@ -528,7 +516,7 @@
]
}
},
"/plans/{id}/activate": {
"/v1/billing/plans/{id}/activate": {
"post": {
"summary": "Activate plan",
"description": "Activates a plan, by ID.",
Expand Down Expand Up @@ -620,9 +608,6 @@
}
},
"parameters": [
{
"$ref": "#/components/parameters/authorization"
},
{
"$ref": "#/components/parameters/content_type"
},
Expand All @@ -642,7 +627,7 @@
]
}
},
"/plans/{id}/deactivate": {
"/v1/billing/plans/{id}/deactivate": {
"post": {
"summary": "Deactivate plan",
"description": "Deactivates a plan, by ID.",
Expand Down Expand Up @@ -734,9 +719,6 @@
}
},
"parameters": [
{
"$ref": "#/components/parameters/authorization"
},
{
"$ref": "#/components/parameters/content_type"
},
Expand All @@ -756,7 +738,7 @@
]
}
},
"/plans/{id}/update-pricing-schemes": {
"/v1/billing/plans/{id}/update-pricing-schemes": {
"post": {
"summary": "Update pricing",
"description": "Updates pricing for a plan. For example, you can update a regular billing cycle from $5 per month to $7 per month.",
Expand Down Expand Up @@ -865,9 +847,6 @@
}
},
"parameters": [
{
"$ref": "#/components/parameters/authorization"
},
{
"$ref": "#/components/parameters/content_type"
},
Expand Down Expand Up @@ -901,7 +880,7 @@
]
}
},
"/subscriptions": {
"/v1/billing/subscriptions": {
"post": {
"summary": "Create subscription",
"description": "Creates a subscription.",
Expand Down Expand Up @@ -1020,9 +999,6 @@
}
},
"parameters": [
{
"$ref": "#/components/parameters/authorization"
},
{
"$ref": "#/components/parameters/content_type"
},
Expand Down Expand Up @@ -1059,7 +1035,7 @@
]
}
},
"/subscriptions/{id}": {
"/v1/billing/subscriptions/{id}": {
"get": {
"summary": "Show subscription details",
"description": "Shows details for a subscription, by ID.",
Expand Down Expand Up @@ -1141,9 +1117,6 @@
}
},
"parameters": [
{
"$ref": "#/components/parameters/authorization"
},
{
"$ref": "#/components/parameters/content_type"
},
Expand Down Expand Up @@ -1273,9 +1246,6 @@
}
},
"parameters": [
{
"$ref": "#/components/parameters/authorization"
},
{
"$ref": "#/components/parameters/content_type"
},
Expand All @@ -1298,7 +1268,7 @@
]
}
},
"/subscriptions/{id}/revise": {
"/v1/billing/subscriptions/{id}/revise": {
"post": {
"summary": "Revise plan or quantity of subscription",
"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.",
Expand Down Expand Up @@ -1419,9 +1389,6 @@
}
},
"parameters": [
{
"$ref": "#/components/parameters/authorization"
},
{
"$ref": "#/components/parameters/content_type"
},
Expand Down Expand Up @@ -1455,7 +1422,7 @@
]
}
},
"/subscriptions/{id}/suspend": {
"/v1/billing/subscriptions/{id}/suspend": {
"post": {
"summary": "Suspend subscription",
"description": "Suspends the subscription.",
Expand Down Expand Up @@ -1564,9 +1531,6 @@
}
},
"parameters": [
{
"$ref": "#/components/parameters/authorization"
},
{
"$ref": "#/components/parameters/content_type"
},
Expand Down Expand Up @@ -1600,7 +1564,7 @@
]
}
},
"/subscriptions/{id}/cancel": {
"/v1/billing/subscriptions/{id}/cancel": {
"post": {
"summary": "Cancel subscription",
"description": "Cancels the subscription.",
Expand Down Expand Up @@ -1709,9 +1673,6 @@
}
},
"parameters": [
{
"$ref": "#/components/parameters/authorization"
},
{
"$ref": "#/components/parameters/content_type"
},
Expand Down Expand Up @@ -1745,7 +1706,7 @@
]
}
},
"/subscriptions/{id}/activate": {
"/v1/billing/subscriptions/{id}/activate": {
"post": {
"summary": "Activate subscription",
"description": "Activates the subscription.",
Expand Down Expand Up @@ -1854,9 +1815,6 @@
}
},
"parameters": [
{
"$ref": "#/components/parameters/authorization"
},
{
"$ref": "#/components/parameters/content_type"
},
Expand Down Expand Up @@ -1890,7 +1848,7 @@
]
}
},
"/subscriptions/{id}/capture": {
"/v1/billing/subscriptions/{id}/capture": {
"post": {
"summary": "Capture authorized payment on subscription",
"description": "Captures an authorized payment from the subscriber on the subscription.",
Expand Down Expand Up @@ -2009,9 +1967,6 @@
}
},
"parameters": [
{
"$ref": "#/components/parameters/authorization"
},
{
"$ref": "#/components/parameters/content_type"
},
Expand Down Expand Up @@ -2048,7 +2003,7 @@
]
}
},
"/subscriptions/{id}/transactions": {
"/v1/billing/subscriptions/{id}/transactions": {
"get": {
"summary": "List transactions for subscription",
"description": "Lists transactions for a subscription.",
Expand Down Expand Up @@ -2147,9 +2102,6 @@
}
},
"parameters": [
{
"$ref": "#/components/parameters/authorization"
},
{
"$ref": "#/components/parameters/content_type"
},
Expand Down Expand Up @@ -2187,11 +2139,16 @@
}
],
"externalDocs": {
"url": "../doc/USERGUIDE.md"
"url": "https://developer.paypal.com/docs/api/subscriptions/v1/"
},
"servers": [
{
"url": "https://api-m.paypal.com/v1/billing"
"url": "https://api-m.sandbox.paypal.com",
"description": "PayPal Sandbox Environment"
},
{
"url": "https://api-m.paypal.com",
"description": "PayPal Live Environment"
}
],
"components": {
Expand All @@ -2217,7 +2174,7 @@
"description": "Oauth 2.0 authentication",
"flows": {
"clientCredentials": {
"tokenUrl": "https://api-m.paypal.com/v1/oauth2/token",
"tokenUrl": "/v1/oauth2/token",
"scopes": {
"https://uri.paypal.com/services/subscriptions": "Manage plan & subscription"
}
Expand All @@ -2226,22 +2183,14 @@
}
},
"parameters": {
"authorization": {
"name": "Authorization",
"in": "header",
"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>.",
"required": true,
"schema": {
"type": "string"
}
},
"content_type": {
"name": "Content-Type",
"in": "header",
"description": "The media type. Required for operations with a request body. The value is `application/<format>`, where the `format` is `json`.",
"required": true,
"schema": {
"type": "string"
"type": "string",
"default": "application/json"
}
},
"prefer": {
Expand Down
Loading

0 comments on commit 6f8a0f1

Please sign in to comment.