Skip to content

Commit

Permalink
Merge pull request #58 from Squidex/openapi-generator
Browse files Browse the repository at this point in the history
Move to OpenAPI Generator
  • Loading branch information
SebastianStehle authored Aug 27, 2024
2 parents 0b27053 + 33c5e0d commit db4ae63
Show file tree
Hide file tree
Showing 975 changed files with 62,519 additions and 29,184 deletions.
18 changes: 0 additions & 18 deletions .fernignore

This file was deleted.

3 changes: 0 additions & 3 deletions .github/workflows/check-updates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ concurrency: check

on:
workflow_dispatch:
schedule:
# Automatically run on every Sunday
- cron: '0 0 * * 0'

jobs:
build:
Expand Down
48 changes: 29 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,40 @@ jobs:
uses: actions/[email protected]

- name: Set up node
uses: actions/setup-node@v3

- name: Compile
run: yarn && yarn build

publish:
needs: [ compile ]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/[email protected]
uses: actions/[email protected]
with:
node-version: 20

- name: Set up node
uses: actions/setup-node@v3
- name: Build - Install
run: npm i

- name: Build - Compile
run: npm run build

- name: Install dependencies
run: yarn install
- name: Test - Start Compose
run: docker compose up -d
working-directory: tests/docker

- name: Build
run: yarn build
- name: Test - RUN
run: npm test
env:
CONFIG__WAIT: 60
CONFIG__SERVER__URL: http://localhost:8080

- name: Test - Dump docker logs on failure
if: failure()
uses: jwalton/[email protected]
with:
images: 'squidex,squidex/resizer'
tail: '100'

- name: Test - Cleanup
if: always()
run: docker compose down
working-directory: tests/docker

- name: Publish to npm
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
run: |
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
npm publish --access public
Expand Down
42 changes: 0 additions & 42 deletions .github/workflows/test.yml

This file was deleted.

30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,33 +57,33 @@ try {
fromSnapshots: true,
});
} catch (err) {
if (err instanceof Squidex.BadRequestError) {
console.log(err.statusCode);
console.log(err.message);
console.log(err.body);
}
if (err instanceof Squidex.BadRequestError) {
console.log(err.statusCode);
console.log(err.message);
console.log(err.body);
}
}
```

Error codes are as followed:

| Status Code | Error Type |
| ----------- | -------------------------- |
| 400 | `BadRequestError` |
| 403 | `ForbiddenError` |
| 404 | `NotFoundError` |
| 409 | `ConflictError` |
| 413 | `ContentTooLargeError` |
| 500 | `InternalServerError` |
| 501 | `NotImplementedError` |
| Status Code | Error Type |
| ----------- | ---------------------- |
| 400 | `BadRequestError` |
| 403 | `ForbiddenError` |
| 404 | `NotFoundError` |
| 409 | `ConflictError` |
| 413 | `ContentTooLargeError` |
| 500 | `InternalServerError` |
| 501 | `NotImplementedError` |

## Release Candidate status

This SDK is a release candidate, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning the package version to a specific version in your package.json file. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.

## Usage in TypeScript ESM Projects

Learn more about ESM [here](https://www.typescriptlang.org/docs/handbook/esm-node.html).
Learn more about ESM [here](https://www.typescriptlang.org/docs/handbook/esm-node.html).

To ensure maximum compatability, the Squidex Node SDK is transpiled to CJS JavaScript. If your project is TypeScript ESM, make sure to enable [`esModuleInterop`](https://www.typescriptlang.org/tsconfig#esModuleInterop) in your tsconfig.json so that the imports in this package work correctly.

Expand Down
24 changes: 24 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// @ts-check

import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import unusedImports from "eslint-plugin-unused-imports";

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
{
plugins: {
"unused-imports": unusedImports,
},
rules: {
"no-unused-vars": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-empty-object-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
}
}
);
2 changes: 2 additions & 0 deletions generate.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli config-help -g php
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate -i /local/openapi.json -g typescript-fetch --template-dir /local/templates -o /local/src/generated -c /local/openapi-config.yml
12 changes: 6 additions & 6 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/** @type {import('jest').Config} */
const config = {
globalSetup: './tests/globalSetup.ts',
globalTeardown: './tests/globalTeardown.ts',
testTimeout: 5000
};
module.exports = config;
globalSetup: "./tests/_setup",
globalTeardown: "./tests/_teardown",
testTimeout: 5000,
};

module.exports = config;
9 changes: 9 additions & 0 deletions openapi-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
globalProperties:
apiDocs: false
apiTests: false
modelDocs: false
modelTests: false

additionalProperties:
withInterfaces: true
useSingleRequestParameter: true
Loading

0 comments on commit db4ae63

Please sign in to comment.