Skip to content

Commit

Permalink
#3 wip join openapi documents
Browse files Browse the repository at this point in the history
  • Loading branch information
bennobuilder committed Aug 28, 2024
1 parent 56d849e commit 2f92e9f
Show file tree
Hide file tree
Showing 9 changed files with 353 additions and 276 deletions.
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"build": "shx rm -rf dist && pnpm run openapi:generate && chmod +x ../../scripts/cli.sh && ../../scripts/cli.sh bundle -b typesonly",
"openapi:generate": "pnpm run openapi:generate:api",
"openapi:generate:api": "npx openapi-typescript ./src/api/resources/energy-label-api_v1.yaml -o ./src/api/.openapi/energy-label-api-v1.ts && npx openapi-typescript ./src/api/resources/shopify-api_v1.yaml -o ./src/api/.openapi/shopify-api-v1.ts",
"openapi:generate:api": "npx openapi-typescript --redocly ./src/api/resources/redocly.yaml",
"lint": "eslint --ext .js,.ts src/",
"clean": "shx rm -rf dist && shx rm -rf node_modules && shx rm -rf .turbo",
"install:clean": "pnpm run clean && pnpm install"
Expand Down
122 changes: 122 additions & 0 deletions packages/types/src/api/.openapi/api-v1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
/**
* This file was auto-generated by openapi-typescript.
* Do not make direct changes to the file.
*/

export interface paths {
"/v1/shopify": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/v1/energy-label": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
}
export type webhooks = Record<string, never>;
export interface components {
schemas: {
/**
* @description The current health status of the API:
* * `Up` - Fully operational
* * `Restricted` - Partially operational
* * `Down` - Not operational
*
* @enum {string}
*/
HealthStatus: "Up" | "Restricted" | "Down";
/** @example {
* "error_code": "#ERR_INVALID_INPUT",
* "error_description": "Invalid input",
* "error_uri": "https://api.builder.group/docs/errors#ERR_INVALID_INPUT",
* "additional_errors": []
* } */
AppErrorDto: {
/** @description Error code */
error_code: string;
/** @description Error description */
error_description?: string;
/** @description Error URI for more information */
error_uri?: string | null;
/** @description Additional error details */
additional_errors?: Record<string, never>[];
};
/** @example {
* "status": "Up",
* "message": "API is functioning normally"
* } */
HealthDto: {
status: components["schemas"]["HealthStatus"];
/** @description Additional health check information */
message: string;
};
};
responses: {
/** @description Bad request */
BadRequest: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["AppErrorDto"];
};
};
/** @description Unauthorized */
Unauthorized: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["AppErrorDto"];
};
};
/** @description Resource not found */
NotFound: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["AppErrorDto"];
};
};
/** @description Internal server error */
InternalServerError: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["AppErrorDto"];
};
};
};
parameters: never;
requestBodies: never;
headers: never;
pathItems: never;
}
export type $defs = Record<string, never>;
export type operations = Record<string, never>;
80 changes: 40 additions & 40 deletions packages/types/src/api/.openapi/energy-label-api-v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,40 +216,6 @@ export interface paths {
export type webhooks = Record<string, never>;
export interface components {
schemas: {
/** @example {
* "error_code": "#ERR_INVALID_INPUT",
* "error_description": "Invalid input",
* "error_uri": "https://api.builder.group/docs/errors#ERR_INVALID_INPUT",
* "additional_errors": []
* } */
AppErrorDto: {
/** @description Error code */
error_code: string;
/** @description Error description */
error_description?: string;
/** @description Error URI for more information */
error_uri?: string | null;
/** @description Additional error details */
additional_errors?: Record<string, never>[];
};
/** @example {
* "status": "Up",
* "message": "API is functioning normally"
* } */
HealthDto: {
status: components["schemas"]["HealthStatus"];
/** @description Additional health check information */
message: string;
};
/**
* @description The current health status of the API:
* * `Up` - Fully operational
* * `Restricted` - Partially operational
* * `Down` - Not operational
*
* @enum {string}
*/
HealthStatus: "Up" | "Restricted" | "Down";
ProductGroupListDto: components["schemas"]["ProductGroupDto"][];
ProductGroupDto: {
/** @example AIR_CONDITIONER */
Expand Down Expand Up @@ -301,10 +267,44 @@ export interface components {
* ] */
urls?: string[];
};
/**
* @description The current health status of the API:
* * `Up` - Fully operational
* * `Restricted` - Partially operational
* * `Down` - Not operational
*
* @enum {string}
*/
HealthStatus: "Up" | "Restricted" | "Down";
/** @example {
* "status": "Up",
* "message": "API is functioning normally"
* } */
HealthDto: {
status: components["schemas"]["HealthStatus"];
/** @description Additional health check information */
message: string;
};
/** @example {
* "error_code": "#ERR_INVALID_INPUT",
* "error_description": "Invalid input",
* "error_uri": "https://api.builder.group/docs/errors#ERR_INVALID_INPUT",
* "additional_errors": []
* } */
AppErrorDto: {
/** @description Error code */
error_code: string;
/** @description Error description */
error_description?: string;
/** @description Error URI for more information */
error_uri?: string | null;
/** @description Additional error details */
additional_errors?: Record<string, never>[];
};
};
responses: {
/** @description Bad request */
BadRequest: {
/** @description Internal server error */
InternalServerError: {
headers: {
[name: string]: unknown;
};
Expand All @@ -321,17 +321,17 @@ export interface components {
"application/json": components["schemas"]["AppErrorDto"];
};
};
/** @description Resource not found */
NotFound: {
/** @description Bad request */
BadRequest: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["AppErrorDto"];
};
};
/** @description Internal server error */
InternalServerError: {
/** @description Resource not found */
NotFound: {
headers: {
[name: string]: unknown;
};
Expand Down
84 changes: 42 additions & 42 deletions packages/types/src/api/.openapi/shopify-api-v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,40 +97,6 @@ export interface paths {
export type webhooks = Record<string, never>;
export interface components {
schemas: {
/** @example {
* "error_code": "#ERR_INVALID_INPUT",
* "error_description": "Invalid input",
* "error_uri": "https://api.builder.group/docs/errors#ERR_INVALID_INPUT",
* "additional_errors": []
* } */
AppErrorDto: {
/** @description Error code */
error_code: string;
/** @description Error description */
error_description?: string;
/** @description Error URI for more information */
error_uri?: string | null;
/** @description Additional error details */
additional_errors?: Record<string, never>[];
};
/** @example {
* "status": "Up",
* "message": "API is functioning normally"
* } */
HealthDto: {
status: components["schemas"]["HealthStatus"];
/** @description Additional health check information */
message: string;
};
/**
* @description The current health status of the API:
* * `Up` - Fully operational
* * `Restricted` - Partially operational
* * `Down` - Not operational
*
* @enum {string}
*/
HealthStatus: "Up" | "Restricted" | "Down";
/** @example {
* "id": "session123",
* "app": "myShopifyApp",
Expand Down Expand Up @@ -165,37 +131,71 @@ export interface components {
/** @description Shopify user ID associated with the session */
userId?: number;
};
/**
* @description The current health status of the API:
* * `Up` - Fully operational
* * `Restricted` - Partially operational
* * `Down` - Not operational
*
* @enum {string}
*/
HealthStatus: "Up" | "Restricted" | "Down";
/** @example {
* "status": "Up",
* "message": "API is functioning normally"
* } */
HealthDto: {
status: components["schemas"]["HealthStatus"];
/** @description Additional health check information */
message: string;
};
/** @example {
* "error_code": "#ERR_INVALID_INPUT",
* "error_description": "Invalid input",
* "error_uri": "https://api.builder.group/docs/errors#ERR_INVALID_INPUT",
* "additional_errors": []
* } */
AppErrorDto: {
/** @description Error code */
error_code: string;
/** @description Error description */
error_description?: string;
/** @description Error URI for more information */
error_uri?: string | null;
/** @description Additional error details */
additional_errors?: Record<string, never>[];
};
};
responses: {
/** @description Bad request */
BadRequest: {
/** @description Internal server error */
InternalServerError: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["AppErrorDto"];
};
};
/** @description Unauthorized */
Unauthorized: {
/** @description Bad request */
BadRequest: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["AppErrorDto"];
};
};
/** @description Resource not found */
NotFound: {
/** @description Unauthorized */
Unauthorized: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["AppErrorDto"];
};
};
/** @description Internal server error */
InternalServerError: {
/** @description Resource not found */
NotFound: {
headers: {
[name: string]: unknown;
};
Expand Down
20 changes: 20 additions & 0 deletions packages/types/src/api/resources/api_v1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
openapi: 3.0.3
info:
title: Builder.Group Combined API
version: 1.0.0
contact:
name: API Support
email: [email protected]
servers:
- url: https://api.builder.group
description: Production server
paths:
/v1/shopify:
$ref: './shopify-api_v1.yaml#/paths'
/v1/energy-label:
$ref: './energy-label-api_v1.yaml#/paths'
components:
schemas:
$ref: './common.yaml#/components/schemas'
responses:
$ref: './common.yaml#/components/responses'
Loading

0 comments on commit 2f92e9f

Please sign in to comment.