diff --git a/.github/workflows/check-generated.yml b/.github/workflows/check-generated.yml new file mode 100644 index 0000000..19e8cfb --- /dev/null +++ b/.github/workflows/check-generated.yml @@ -0,0 +1,33 @@ +name: Check Generated Code + +on: + pull_request: + branches: [main] + +jobs: + check-generated: + if: github.head_ref != 'release' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Bun + uses: oven-sh/setup-bun@v2 + + - name: Install dependencies + run: bun install + + - name: Lint + run: bun run lint + + - name: Regenerate types + run: bun run generate + + - name: Check for stale generated code + run: | + if ! git diff --exit-code generated/; then + echo "" + echo "ERROR: Generated code is out of date." + echo "Run 'bun run generate' locally and commit the result." + exit 1 + fi diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml new file mode 100644 index 0000000..aa542ce --- /dev/null +++ b/.github/workflows/prepare-release.yml @@ -0,0 +1,29 @@ +name: Create Release PR + +on: + push: + branches: [main] + +permissions: + contents: write + +jobs: + prepare-release: + if: "!contains(github.event.head_commit.message, 'chore: prepare release')" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.PAT }} + - name: Configure Git + run: | + git config --global user.name "GitHub Actions" + git config --global user.email "github-actions@github.com" + - name: Install Knope + uses: knope-dev/action@v2.1.2 + with: + version: 0.22.3 + - run: knope prepare-release --verbose + env: + GITHUB_TOKEN: ${{ secrets.PAT }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..85dbc5f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,112 @@ +name: Release + +on: + pull_request: + types: [closed] + branches: [main] + +permissions: + contents: write + id-token: write + +jobs: + create-release: + if: github.head_ref == 'release' && github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install Knope + uses: knope-dev/action@v2.1.2 + with: + version: 0.22.3 + + - name: Configure Git identity + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + - name: Create GitHub releases + run: knope release --verbose + env: + GITHUB_TOKEN: ${{ secrets.PAT }} + + publish-ts: + needs: create-release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: "22" + registry-url: "https://registry.npmjs.org" + + - uses: oven-sh/setup-bun@v2 + + - name: Install dependencies (TS) + working-directory: generated/packages/ts + run: bun install + + - name: Publish to npm + working-directory: generated/packages/ts + run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + BUN_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + publish-py: + if: false # set to false to skip PyPI publish + needs: create-release + runs-on: ubuntu-latest + permissions: + id-token: write + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install build tools + run: pip install build + + - name: Build package + working-directory: generated/packages/py + run: python -m build + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: generated/packages/py/dist/ + + publish-rs: + if: false # set to false to skip crates.io publish + needs: create-release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: dtolnay/rust-toolchain@stable + + - name: Publish to crates.io + working-directory: generated/packages/rs + run: cargo publish + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + + publish-go: + needs: create-release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Verify Go module tag + run: | + echo "Go modules use git tags for versioning." + echo "The tag created by knope release is sufficient for go get." + git tag --list 'go/v*' | tail -5 diff --git a/.github/workflows/test-installs.yml b/.github/workflows/test-installs.yml new file mode 100644 index 0000000..d2e41ce --- /dev/null +++ b/.github/workflows/test-installs.yml @@ -0,0 +1,73 @@ +name: Test Package Installs + +on: + push: + branches: [main, "feat/**"] + pull_request: + workflow_dispatch: + inputs: + test-py: + description: "Run Python install test" + type: boolean + default: false + test-rs: + description: "Run Rust check test" + type: boolean + default: false + +jobs: + test-ts: + name: TypeScript Install + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "22" + - name: Install & smoke test + run: | + cd generated/packages/ts + npm install --ignore-scripts + node -e "import('./index.js').then(m => console.log('TS OK:', Object.keys(m)))" + + test-go: + name: Go Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: "1.24" + - name: Build + run: | + cd generated/packages/go + go build ./... + echo "Go OK" + + test-py: + if: ${{ inputs.test-py == true }} + name: Python Install + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + - name: Install & smoke test + run: | + cd generated/packages/py + pip install . --quiet + python -c "from open_rpc_spec_types import v1_4, v1_3; print('Py OK')" + + test-rs: + if: ${{ inputs.test-rs == true }} + name: Rust Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - name: Check + run: | + cd generated/packages/rs + cargo check + echo "Rust OK" diff --git a/.gitignore b/.gitignore index 9a5aced..83cda72 100644 --- a/.gitignore +++ b/.gitignore @@ -137,3 +137,8 @@ dist # Vite logs files vite.config.js.timestamp-* vite.config.ts.timestamp-* + +.cursor + +LLMLOG.MD +.DS_Store \ No newline at end of file diff --git a/.prettierc b/.prettierc new file mode 100644 index 0000000..20133e6 --- /dev/null +++ b/.prettierc @@ -0,0 +1,12 @@ +{ + "endOfLine": "lf", + "bracketSameLine": false, + "arrowParens": "always", + "bracketSpacing": true, + "useTabs": false, + "tabWidth": 2, + "printWidth": 100, + "trailingComma": "esnext", + "singleQuote": true, + "semi": true +} \ No newline at end of file diff --git a/bun.lock b/bun.lock new file mode 100644 index 0000000..c8a2ef2 --- /dev/null +++ b/bun.lock @@ -0,0 +1,282 @@ +{ + "lockfileVersion": 1, + "workspaces": { + "": { + "name": "spec-types", + "dependencies": { + "@json-schema-tools/transpiler": "^1.10.5", + "@open-rpc/spec": "^1.4.0", + }, + "devDependencies": { + "@eslint/js": "^10.0.1", + "@iarna/toml": "^2.2.5", + "@json-schema-tools/dereferencer": "^1.6.3", + "@json-schema-tools/meta-schema": "^1.8.0", + "@types/bun": "latest", + "@types/node": "^25.3.0", + "@typescript-eslint/eslint-plugin": "^8.55.0", + "eslint": "^10.0.0", + "eslint-config-prettier": "^10.1.8", + "eslint-plugin-prettier": "^5.5.5", + "globals": "^17.3.0", + "prettier": "^3.8.1", + "typescript": "^5.9.3", + }, + }, + }, + "packages": { + "@eslint-community/eslint-utils": ["@eslint-community/eslint-utils@4.9.1", "", { "dependencies": { "eslint-visitor-keys": "^3.4.3" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ=="], + + "@eslint-community/regexpp": ["@eslint-community/regexpp@4.12.2", "", {}, "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew=="], + + "@eslint/config-array": ["@eslint/config-array@0.23.1", "", { "dependencies": { "@eslint/object-schema": "^3.0.1", "debug": "^4.3.1", "minimatch": "^10.1.1" } }, "sha512-uVSdg/V4dfQmTjJzR0szNczjOH/J+FyUMMjYtr07xFRXR7EDf9i1qdxrD0VusZH9knj1/ecxzCQQxyic5NzAiA=="], + + "@eslint/config-helpers": ["@eslint/config-helpers@0.5.2", "", { "dependencies": { "@eslint/core": "^1.1.0" } }, "sha512-a5MxrdDXEvqnIq+LisyCX6tQMPF/dSJpCfBgBauY+pNZ28yCtSsTvyTYrMhaI+LK26bVyCJfJkT0u8KIj2i1dQ=="], + + "@eslint/core": ["@eslint/core@1.1.0", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-/nr9K9wkr3P1EzFTdFdMoLuo1PmIxjmwvPozwoSodjNBdefGujXQUF93u1DDZpEaTuDvMsIQddsd35BwtrW9Xw=="], + + "@eslint/js": ["@eslint/js@10.0.1", "", { "peerDependencies": { "eslint": "^10.0.0" }, "optionalPeers": ["eslint"] }, "sha512-zeR9k5pd4gxjZ0abRoIaxdc7I3nDktoXZk2qOv9gCNWx3mVwEn32VRhyLaRsDiJjTs0xq/T8mfPtyuXu7GWBcA=="], + + "@eslint/object-schema": ["@eslint/object-schema@3.0.1", "", {}, "sha512-P9cq2dpr+LU8j3qbLygLcSZrl2/ds/pUpfnHNNuk5HW7mnngHs+6WSq5C9mO3rqRX8A1poxqLTC9cu0KOyJlBg=="], + + "@eslint/plugin-kit": ["@eslint/plugin-kit@0.6.0", "", { "dependencies": { "@eslint/core": "^1.1.0", "levn": "^0.4.1" } }, "sha512-bIZEUzOI1jkhviX2cp5vNyXQc6olzb2ohewQubuYlMXZ2Q/XjBO0x0XhGPvc9fjSIiUN0vw+0hq53BJ4eQSJKQ=="], + + "@humanfs/core": ["@humanfs/core@0.19.1", "", {}, "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA=="], + + "@humanfs/node": ["@humanfs/node@0.16.7", "", { "dependencies": { "@humanfs/core": "^0.19.1", "@humanwhocodes/retry": "^0.4.0" } }, "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ=="], + + "@humanwhocodes/module-importer": ["@humanwhocodes/module-importer@1.0.1", "", {}, "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA=="], + + "@humanwhocodes/retry": ["@humanwhocodes/retry@0.4.3", "", {}, "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ=="], + + "@iarna/toml": ["@iarna/toml@2.2.5", "", {}, "sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg=="], + + "@isaacs/cliui": ["@isaacs/cliui@9.0.0", "", {}, "sha512-AokJm4tuBHillT+FpMtxQ60n8ObyXBatq7jD2/JA9dxbDDokKQm8KMht5ibGzLVU9IJDIKK4TPKgMHEYMn3lMg=="], + + "@json-schema-spec/json-pointer": ["@json-schema-spec/json-pointer@0.1.2", "", {}, "sha512-BYY7IavBjwsWWSmVcMz2A9mKiDD9RvacnsItgmy1xV8cmgbtxFfKmKMtkVpD7pYtkx4mIW4800yZBXueVFIWPw=="], + + "@json-schema-tools/dereferencer": ["@json-schema-tools/dereferencer@1.6.3", "", { "dependencies": { "@json-schema-tools/reference-resolver": "^1.2.6", "@json-schema-tools/traverse": "^1.10.4", "fast-safe-stringify": "^2.1.1" } }, "sha512-NoQkj6hx9Joqbd/GZAOHSGtE6R+OzlnOcDfyidmx8e/CUv1Q+Z6/fmZo2wwCQWiwP1pnGYc95iKwp8M7XlV7wQ=="], + + "@json-schema-tools/meta-schema": ["@json-schema-tools/meta-schema@1.8.0", "", {}, "sha512-pbRAbHidPTf96LhmHXA6bl4D4tz4HrwjZ7A5ConcLFPdCj+93GhsCCFsq+AWti4VOs+9QTezX5l0zLNA+TZv1g=="], + + "@json-schema-tools/reference-resolver": ["@json-schema-tools/reference-resolver@1.2.6", "", { "dependencies": { "@json-schema-spec/json-pointer": "^0.1.2", "isomorphic-fetch": "^3.0.0" } }, "sha512-4QZu5ROb5EpLSvV+buzk8WR30W+dffSNaKqD3VGFYJ3y0BLDi2OHoSz5e6NKcLYTyUYXV8IKxocNOszeVBJI4Q=="], + + "@json-schema-tools/referencer": ["@json-schema-tools/referencer@1.1.3", "", { "dependencies": { "@json-schema-tools/traverse": "^1.10.4" } }, "sha512-p2JU7GpHn1kMyP7gnB2Wnki+OnifsSi75Uj5PxqIg2pT4fqh+BM3rEEZKpaET4xv0ZszG46CCI9eEvs68v2rXg=="], + + "@json-schema-tools/titleizer": ["@json-schema-tools/titleizer@1.0.9", "", { "dependencies": { "@json-schema-tools/traverse": "^1.10.4" } }, "sha512-Gwg3YTP5P+3Q+OnvEcthTnsup3AsEkxZCrRLXoWppdjtSzRnsWxtvmpKdGLbVcocPC7Sh3aqJ7Arp85Ii6q2GA=="], + + "@json-schema-tools/transpiler": ["@json-schema-tools/transpiler@1.10.5", "", { "dependencies": { "@json-schema-tools/referencer": "^1.1.3", "@json-schema-tools/titleizer": "^1.0.9", "@json-schema-tools/traverse": "^1.10.4", "lodash.camelcase": "^4.3.0", "lodash.deburr": "^4.1.0", "lodash.snakecase": "^4.1.1", "lodash.trim": "^4.5.1" } }, "sha512-uRm43U8wKWQV8czvvkJYwcUERpQC+azKmqbd7RhV1gWx7s1t0frLtrWqGbXh9xMcgdtF7+Tkiwex48nW5EnX1w=="], + + "@json-schema-tools/traverse": ["@json-schema-tools/traverse@1.11.0", "", {}, "sha512-GWQRiXXsbt5ZuewItpW2nqB/D0x4pKWi6XXOwoh1wvmsU/tQSq/rKzpgGvOHTe6v30TYDwZYxuwnRnArIsUzLQ=="], + + "@open-rpc/spec": ["@open-rpc/spec@1.4.0", "", {}, "sha512-PbfLgGMJZNUurFLFmu+5KU5CwQ6gKto3eLP8oVZh4Onf+paQkR/4L3/SYU8bqGwatMyXiqYwtXRjE6cenQkQ+g=="], + + "@pkgr/core": ["@pkgr/core@0.2.9", "", {}, "sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA=="], + + "@types/bun": ["@types/bun@1.3.9", "", { "dependencies": { "bun-types": "1.3.9" } }, "sha512-KQ571yULOdWJiMH+RIWIOZ7B2RXQGpL1YQrBtLIV3FqDcCu6FsbFUBwhdKUlCKUpS3PJDsHlJ1QKlpxoVR+xtw=="], + + "@types/esrecurse": ["@types/esrecurse@4.3.1", "", {}, "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw=="], + + "@types/estree": ["@types/estree@1.0.8", "", {}, "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w=="], + + "@types/json-schema": ["@types/json-schema@7.0.15", "", {}, "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA=="], + + "@types/node": ["@types/node@25.3.0", "", { "dependencies": { "undici-types": "~7.18.0" } }, "sha512-4K3bqJpXpqfg2XKGK9bpDTc6xO/xoUP/RBWS7AtRMug6zZFaRekiLzjVtAoZMquxoAbzBvy5nxQ7veS5eYzf8A=="], + + "@typescript-eslint/eslint-plugin": ["@typescript-eslint/eslint-plugin@8.55.0", "", { "dependencies": { "@eslint-community/regexpp": "^4.12.2", "@typescript-eslint/scope-manager": "8.55.0", "@typescript-eslint/type-utils": "8.55.0", "@typescript-eslint/utils": "8.55.0", "@typescript-eslint/visitor-keys": "8.55.0", "ignore": "^7.0.5", "natural-compare": "^1.4.0", "ts-api-utils": "^2.4.0" }, "peerDependencies": { "@typescript-eslint/parser": "^8.55.0", "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-1y/MVSz0NglV1ijHC8OT49mPJ4qhPYjiK08YUQVbIOyu+5k862LKUHFkpKHWu//zmr7hDR2rhwUm6gnCGNmGBQ=="], + + "@typescript-eslint/parser": ["@typescript-eslint/parser@8.55.0", "", { "dependencies": { "@typescript-eslint/scope-manager": "8.55.0", "@typescript-eslint/types": "8.55.0", "@typescript-eslint/typescript-estree": "8.55.0", "@typescript-eslint/visitor-keys": "8.55.0", "debug": "^4.4.3" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-4z2nCSBfVIMnbuu8uinj+f0o4qOeggYJLbjpPHka3KH1om7e+H9yLKTYgksTaHcGco+NClhhY2vyO3HsMH1RGw=="], + + "@typescript-eslint/project-service": ["@typescript-eslint/project-service@8.55.0", "", { "dependencies": { "@typescript-eslint/tsconfig-utils": "^8.55.0", "@typescript-eslint/types": "^8.55.0", "debug": "^4.4.3" }, "peerDependencies": { "typescript": ">=4.8.4 <6.0.0" } }, "sha512-zRcVVPFUYWa3kNnjaZGXSu3xkKV1zXy8M4nO/pElzQhFweb7PPtluDLQtKArEOGmjXoRjnUZ29NjOiF0eCDkcQ=="], + + "@typescript-eslint/scope-manager": ["@typescript-eslint/scope-manager@8.55.0", "", { "dependencies": { "@typescript-eslint/types": "8.55.0", "@typescript-eslint/visitor-keys": "8.55.0" } }, "sha512-fVu5Omrd3jeqeQLiB9f1YsuK/iHFOwb04bCtY4BSCLgjNbOD33ZdV6KyEqplHr+IlpgT0QTZ/iJ+wT7hvTx49Q=="], + + "@typescript-eslint/tsconfig-utils": ["@typescript-eslint/tsconfig-utils@8.55.0", "", { "peerDependencies": { "typescript": ">=4.8.4 <6.0.0" } }, "sha512-1R9cXqY7RQd7WuqSN47PK9EDpgFUK3VqdmbYrvWJZYDd0cavROGn+74ktWBlmJ13NXUQKlZ/iAEQHI/V0kKe0Q=="], + + "@typescript-eslint/type-utils": ["@typescript-eslint/type-utils@8.55.0", "", { "dependencies": { "@typescript-eslint/types": "8.55.0", "@typescript-eslint/typescript-estree": "8.55.0", "@typescript-eslint/utils": "8.55.0", "debug": "^4.4.3", "ts-api-utils": "^2.4.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-x1iH2unH4qAt6I37I2CGlsNs+B9WGxurP2uyZLRz6UJoZWDBx9cJL1xVN/FiOmHEONEg6RIufdvyT0TEYIgC5g=="], + + "@typescript-eslint/types": ["@typescript-eslint/types@8.55.0", "", {}, "sha512-ujT0Je8GI5BJWi+/mMoR0wxwVEQaxM+pi30xuMiJETlX80OPovb2p9E8ss87gnSVtYXtJoU9U1Cowcr6w2FE0w=="], + + "@typescript-eslint/typescript-estree": ["@typescript-eslint/typescript-estree@8.55.0", "", { "dependencies": { "@typescript-eslint/project-service": "8.55.0", "@typescript-eslint/tsconfig-utils": "8.55.0", "@typescript-eslint/types": "8.55.0", "@typescript-eslint/visitor-keys": "8.55.0", "debug": "^4.4.3", "minimatch": "^9.0.5", "semver": "^7.7.3", "tinyglobby": "^0.2.15", "ts-api-utils": "^2.4.0" }, "peerDependencies": { "typescript": ">=4.8.4 <6.0.0" } }, "sha512-EwrH67bSWdx/3aRQhCoxDaHM+CrZjotc2UCCpEDVqfCE+7OjKAGWNY2HsCSTEVvWH2clYQK8pdeLp42EVs+xQw=="], + + "@typescript-eslint/utils": ["@typescript-eslint/utils@8.55.0", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.9.1", "@typescript-eslint/scope-manager": "8.55.0", "@typescript-eslint/types": "8.55.0", "@typescript-eslint/typescript-estree": "8.55.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-BqZEsnPGdYpgyEIkDC1BadNY8oMwckftxBT+C8W0g1iKPdeqKZBtTfnvcq0nf60u7MkjFO8RBvpRGZBPw4L2ow=="], + + "@typescript-eslint/visitor-keys": ["@typescript-eslint/visitor-keys@8.55.0", "", { "dependencies": { "@typescript-eslint/types": "8.55.0", "eslint-visitor-keys": "^4.2.1" } }, "sha512-AxNRwEie8Nn4eFS1FzDMJWIISMGoXMb037sgCBJ3UR6o0fQTzr2tqN9WT+DkWJPhIdQCfV7T6D387566VtnCJA=="], + + "acorn": ["acorn@8.15.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg=="], + + "acorn-jsx": ["acorn-jsx@5.3.2", "", { "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ=="], + + "ajv": ["ajv@6.12.6", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g=="], + + "balanced-match": ["balanced-match@4.0.2", "", { "dependencies": { "jackspeak": "^4.2.3" } }, "sha512-x0K50QvKQ97fdEz2kPehIerj+YTeptKF9hyYkKf6egnwmMWAkADiO0QCzSp0R5xN8FTZgYaBfSaue46Ej62nMg=="], + + "brace-expansion": ["brace-expansion@5.0.2", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-Pdk8c9poy+YhOgVWw1JNN22/HcivgKWwpxKq04M/jTmHyCZn12WPJebZxdjSa5TmBqISrUSgNYU3eRORljfCCw=="], + + "bun-types": ["bun-types@1.3.9", "", { "dependencies": { "@types/node": "*" } }, "sha512-+UBWWOakIP4Tswh0Bt0QD0alpTY8cb5hvgiYeWCMet9YukHbzuruIEeXC2D7nMJPB12kbh8C7XJykSexEqGKJg=="], + + "cross-spawn": ["cross-spawn@7.0.6", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="], + + "debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="], + + "deep-is": ["deep-is@0.1.4", "", {}, "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ=="], + + "escape-string-regexp": ["escape-string-regexp@4.0.0", "", {}, "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="], + + "eslint": ["eslint@10.0.0", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.2", "@eslint/config-array": "^0.23.0", "@eslint/config-helpers": "^0.5.2", "@eslint/core": "^1.1.0", "@eslint/plugin-kit": "^0.6.0", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.12.4", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^9.1.0", "eslint-visitor-keys": "^5.0.0", "espree": "^11.1.0", "esquery": "^1.7.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "minimatch": "^10.1.1", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-O0piBKY36YSJhlFSG8p9VUdPV/SxxS4FYDWVpr/9GJuMaepzwlf4J8I4ov1b+ySQfDTPhc3DtLaxcT1fN0yqCg=="], + + "eslint-config-prettier": ["eslint-config-prettier@10.1.8", "", { "peerDependencies": { "eslint": ">=7.0.0" }, "bin": { "eslint-config-prettier": "bin/cli.js" } }, "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w=="], + + "eslint-plugin-prettier": ["eslint-plugin-prettier@5.5.5", "", { "dependencies": { "prettier-linter-helpers": "^1.0.1", "synckit": "^0.11.12" }, "peerDependencies": { "@types/eslint": ">=8.0.0", "eslint": ">=8.0.0", "eslint-config-prettier": ">= 7.0.0 <10.0.0 || >=10.1.0", "prettier": ">=3.0.0" }, "optionalPeers": ["@types/eslint", "eslint-config-prettier"] }, "sha512-hscXkbqUZ2sPithAuLm5MXL+Wph+U7wHngPBv9OMWwlP8iaflyxpjTYZkmdgB4/vPIhemRlBEoLrH7UC1n7aUw=="], + + "eslint-scope": ["eslint-scope@9.1.0", "", { "dependencies": { "@types/esrecurse": "^4.3.1", "@types/estree": "^1.0.8", "esrecurse": "^4.3.0", "estraverse": "^5.2.0" } }, "sha512-CkWE42hOJsNj9FJRaoMX9waUFYhqY4jmyLFdAdzZr6VaCg3ynLYx4WnOdkaIifGfH4gsUcBTn4OZbHXkpLD0FQ=="], + + "eslint-visitor-keys": ["eslint-visitor-keys@5.0.0", "", {}, "sha512-A0XeIi7CXU7nPlfHS9loMYEKxUaONu/hTEzHTGba9Huu94Cq1hPivf+DE5erJozZOky0LfvXAyrV/tcswpLI0Q=="], + + "espree": ["espree@11.1.0", "", { "dependencies": { "acorn": "^8.15.0", "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^5.0.0" } }, "sha512-WFWYhO1fV4iYkqOOvq8FbqIhr2pYfoDY0kCotMkDeNtGpiGGkZ1iov2u8ydjtgM8yF8rzK7oaTbw2NAzbAbehw=="], + + "esquery": ["esquery@1.7.0", "", { "dependencies": { "estraverse": "^5.1.0" } }, "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g=="], + + "esrecurse": ["esrecurse@4.3.0", "", { "dependencies": { "estraverse": "^5.2.0" } }, "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag=="], + + "estraverse": ["estraverse@5.3.0", "", {}, "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA=="], + + "esutils": ["esutils@2.0.3", "", {}, "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="], + + "fast-deep-equal": ["fast-deep-equal@3.1.3", "", {}, "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="], + + "fast-diff": ["fast-diff@1.3.0", "", {}, "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw=="], + + "fast-json-stable-stringify": ["fast-json-stable-stringify@2.1.0", "", {}, "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="], + + "fast-levenshtein": ["fast-levenshtein@2.0.6", "", {}, "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw=="], + + "fast-safe-stringify": ["fast-safe-stringify@2.1.1", "", {}, "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA=="], + + "fdir": ["fdir@6.5.0", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="], + + "file-entry-cache": ["file-entry-cache@8.0.0", "", { "dependencies": { "flat-cache": "^4.0.0" } }, "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ=="], + + "find-up": ["find-up@5.0.0", "", { "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" } }, "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng=="], + + "flat-cache": ["flat-cache@4.0.1", "", { "dependencies": { "flatted": "^3.2.9", "keyv": "^4.5.4" } }, "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw=="], + + "flatted": ["flatted@3.3.3", "", {}, "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg=="], + + "glob-parent": ["glob-parent@6.0.2", "", { "dependencies": { "is-glob": "^4.0.3" } }, "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A=="], + + "globals": ["globals@17.3.0", "", {}, "sha512-yMqGUQVVCkD4tqjOJf3TnrvaaHDMYp4VlUSObbkIiuCPe/ofdMBFIAcBbCSRFWOnos6qRiTVStDwqPLUclaxIw=="], + + "ignore": ["ignore@7.0.5", "", {}, "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg=="], + + "imurmurhash": ["imurmurhash@0.1.4", "", {}, "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA=="], + + "is-extglob": ["is-extglob@2.1.1", "", {}, "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ=="], + + "is-glob": ["is-glob@4.0.3", "", { "dependencies": { "is-extglob": "^2.1.1" } }, "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg=="], + + "isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="], + + "isomorphic-fetch": ["isomorphic-fetch@3.0.0", "", { "dependencies": { "node-fetch": "^2.6.1", "whatwg-fetch": "^3.4.1" } }, "sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA=="], + + "jackspeak": ["jackspeak@4.2.3", "", { "dependencies": { "@isaacs/cliui": "^9.0.0" } }, "sha512-ykkVRwrYvFm1nb2AJfKKYPr0emF6IiXDYUaFx4Zn9ZuIH7MrzEZ3sD5RlqGXNRpHtvUHJyOnCEFxOlNDtGo7wg=="], + + "json-buffer": ["json-buffer@3.0.1", "", {}, "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ=="], + + "json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="], + + "json-stable-stringify-without-jsonify": ["json-stable-stringify-without-jsonify@1.0.1", "", {}, "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw=="], + + "keyv": ["keyv@4.5.4", "", { "dependencies": { "json-buffer": "3.0.1" } }, "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw=="], + + "levn": ["levn@0.4.1", "", { "dependencies": { "prelude-ls": "^1.2.1", "type-check": "~0.4.0" } }, "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ=="], + + "locate-path": ["locate-path@6.0.0", "", { "dependencies": { "p-locate": "^5.0.0" } }, "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw=="], + + "lodash.camelcase": ["lodash.camelcase@4.3.0", "", {}, "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA=="], + + "lodash.deburr": ["lodash.deburr@4.1.0", "", {}, "sha512-m/M1U1f3ddMCs6Hq2tAsYThTBDaAKFDX3dwDo97GEYzamXi9SqUpjWi/Rrj/gf3X2n8ktwgZrlP1z6E3v/IExQ=="], + + "lodash.snakecase": ["lodash.snakecase@4.1.1", "", {}, "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw=="], + + "lodash.trim": ["lodash.trim@4.5.1", "", {}, "sha512-nJAlRl/K+eiOehWKDzoBVrSMhK0K3A3YQsUNXHQa5yIrKBAhsZgSu3KoAFoFT+mEgiyBHddZ0pRk1ITpIp90Wg=="], + + "minimatch": ["minimatch@10.2.0", "", { "dependencies": { "brace-expansion": "^5.0.2" } }, "sha512-ugkC31VaVg9cF0DFVoADH12k6061zNZkZON+aX8AWsR9GhPcErkcMBceb6znR8wLERM2AkkOxy2nWRLpT9Jq5w=="], + + "ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="], + + "natural-compare": ["natural-compare@1.4.0", "", {}, "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw=="], + + "node-fetch": ["node-fetch@2.7.0", "", { "dependencies": { "whatwg-url": "^5.0.0" }, "peerDependencies": { "encoding": "^0.1.0" }, "optionalPeers": ["encoding"] }, "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A=="], + + "optionator": ["optionator@0.9.4", "", { "dependencies": { "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", "levn": "^0.4.1", "prelude-ls": "^1.2.1", "type-check": "^0.4.0", "word-wrap": "^1.2.5" } }, "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g=="], + + "p-limit": ["p-limit@3.1.0", "", { "dependencies": { "yocto-queue": "^0.1.0" } }, "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ=="], + + "p-locate": ["p-locate@5.0.0", "", { "dependencies": { "p-limit": "^3.0.2" } }, "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw=="], + + "path-exists": ["path-exists@4.0.0", "", {}, "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w=="], + + "path-key": ["path-key@3.1.1", "", {}, "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="], + + "picomatch": ["picomatch@4.0.3", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="], + + "prelude-ls": ["prelude-ls@1.2.1", "", {}, "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g=="], + + "prettier": ["prettier@3.8.1", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg=="], + + "prettier-linter-helpers": ["prettier-linter-helpers@1.0.1", "", { "dependencies": { "fast-diff": "^1.1.2" } }, "sha512-SxToR7P8Y2lWmv/kTzVLC1t/GDI2WGjMwNhLLE9qtH8Q13C+aEmuRlzDst4Up4s0Wc8sF2M+J57iB3cMLqftfg=="], + + "punycode": ["punycode@2.3.1", "", {}, "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="], + + "semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="], + + "shebang-command": ["shebang-command@2.0.0", "", { "dependencies": { "shebang-regex": "^3.0.0" } }, "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA=="], + + "shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="], + + "synckit": ["synckit@0.11.12", "", { "dependencies": { "@pkgr/core": "^0.2.9" } }, "sha512-Bh7QjT8/SuKUIfObSXNHNSK6WHo6J1tHCqJsuaFDP7gP0fkzSfTxI8y85JrppZ0h8l0maIgc2tfuZQ6/t3GtnQ=="], + + "tinyglobby": ["tinyglobby@0.2.15", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.3" } }, "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ=="], + + "tr46": ["tr46@0.0.3", "", {}, "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="], + + "ts-api-utils": ["ts-api-utils@2.4.0", "", { "peerDependencies": { "typescript": ">=4.8.4" } }, "sha512-3TaVTaAv2gTiMB35i3FiGJaRfwb3Pyn/j3m/bfAvGe8FB7CF6u+LMYqYlDh7reQf7UNvoTvdfAqHGmPGOSsPmA=="], + + "type-check": ["type-check@0.4.0", "", { "dependencies": { "prelude-ls": "^1.2.1" } }, "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew=="], + + "typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="], + + "undici-types": ["undici-types@7.18.2", "", {}, "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w=="], + + "uri-js": ["uri-js@4.4.1", "", { "dependencies": { "punycode": "^2.1.0" } }, "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg=="], + + "webidl-conversions": ["webidl-conversions@3.0.1", "", {}, "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="], + + "whatwg-fetch": ["whatwg-fetch@3.6.20", "", {}, "sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg=="], + + "whatwg-url": ["whatwg-url@5.0.0", "", { "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } }, "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw=="], + + "which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="], + + "word-wrap": ["word-wrap@1.2.5", "", {}, "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA=="], + + "yocto-queue": ["yocto-queue@0.1.0", "", {}, "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q=="], + + "@eslint-community/eslint-utils/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="], + + "@typescript-eslint/typescript-estree/minimatch": ["minimatch@9.0.5", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="], + + "@typescript-eslint/visitor-keys/eslint-visitor-keys": ["eslint-visitor-keys@4.2.1", "", {}, "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ=="], + + "bun-types/@types/node": ["@types/node@25.2.3", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-m0jEgYlYz+mDJZ2+F4v8D1AyQb+QzsNqRuI7xg1VQX/KlKS0qT9r1Mo16yo5F/MtifXFgaofIFsdFMox2SxIbQ=="], + + "eslint/ignore": ["ignore@5.3.2", "", {}, "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g=="], + + "@typescript-eslint/typescript-estree/minimatch/brace-expansion": ["brace-expansion@2.0.2", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ=="], + + "bun-types/@types/node/undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="], + + "@typescript-eslint/typescript-estree/minimatch/brace-expansion/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="], + } +} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..a33e775 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,95 @@ +import eslint from '@eslint/js'; +import tseslint from '@typescript-eslint/eslint-plugin'; +import tsParser from '@typescript-eslint/parser'; +import prettierConfig from 'eslint-config-prettier'; +import prettierPlugin from 'eslint-plugin-prettier'; +import { fileURLToPath } from 'url'; +import { dirname } from 'path'; +import globals from "globals"; + + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +export default [ + eslint.configs.recommended, + // Add ignores as a separate config object + { + ignores: [ + "package.json", + "node_modules/", + "generated/", + "**/dist/", + "dist/", + "docs/", // This will now work + "build/", + "coverage/", + "*.config.js", + "**/*.config.ts", + "vitest.config.ts", + "vite.config.ts", + "build.ts" // Add this + + ] + }, + { + files: ['**/*.{ts,tsx}'], + languageOptions: { + parser: tsParser, + parserOptions: { + project: ['./tsconfig.json'], + tsconfigRootDir: __dirname, + ecmaVersion: 2022, + sourceType: 'module', + ecmaFeatures: { + jsx: true + } + }, + globals: { + ...globals.browser, + ...globals.node, + ...globals.es6, + chrome: 'readonly', + browser: 'readonly' + } + }, + plugins: { + '@typescript-eslint': tseslint, + 'prettier': prettierPlugin + }, + rules: { + ...tseslint.configs['recommended'].rules, + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }], + 'no-console': ['warn', { allow: ['warn', 'error'] }], + 'prettier/prettier': 'error' + }, + settings: { } + }, + // Jest test files configuration + { + files: ['**/*.test.{ts,tsx}', '**/*.spec.{ts,tsx}'], + languageOptions: { + globals: { + ...globals.jest, + ...globals.browser, + ...globals.node, + ...globals.es6, + window: 'readonly', + document: 'readonly', + navigator: 'readonly', + console: 'readonly', + localStorage: 'readonly', + sessionStorage: 'readonly', + fetch: 'readonly', + FormData: 'readonly', + URLSearchParams: 'readonly', + chrome: 'readonly', + browser: 'readonly' + } + } + }, + prettierConfig +]; \ No newline at end of file diff --git a/generated/packages/go/CHANGELOG.md b/generated/packages/go/CHANGELOG.md new file mode 100644 index 0000000..e69de29 diff --git a/generated/packages/go/go.mod b/generated/packages/go/go.mod new file mode 100644 index 0000000..676bca0 --- /dev/null +++ b/generated/packages/go/go.mod @@ -0,0 +1,3 @@ +module github.com/zcstarr/spec-types/generated/packages/go // v0.0.0 + +go 1.24.5 diff --git a/generated/packages/go/v1_3/v1_3.go b/generated/packages/go/v1_3/v1_3.go new file mode 100644 index 0000000..3c48396 --- /dev/null +++ b/generated/packages/go/v1_3/v1_3.go @@ -0,0 +1,744 @@ +package v1_3 + +import "encoding/json" +import "errors" +type Openrpc string +const ( + OpenrpcEnum0 Openrpc = "1.3.2" + OpenrpcEnum1 Openrpc = "1.3.1" + OpenrpcEnum2 Openrpc = "1.3.0" + OpenrpcEnum3 Openrpc = "1.2.6" + OpenrpcEnum4 Openrpc = "1.2.5" + OpenrpcEnum5 Openrpc = "1.2.4" + OpenrpcEnum6 Openrpc = "1.2.3" + OpenrpcEnum7 Openrpc = "1.2.2" + OpenrpcEnum8 Openrpc = "1.2.1" + OpenrpcEnum9 Openrpc = "1.2.0" + OpenrpcEnum10 Openrpc = "1.1.12" + OpenrpcEnum11 Openrpc = "1.1.11" + OpenrpcEnum12 Openrpc = "1.1.10" + OpenrpcEnum13 Openrpc = "1.1.9" + OpenrpcEnum14 Openrpc = "1.1.8" + OpenrpcEnum15 Openrpc = "1.1.7" + OpenrpcEnum16 Openrpc = "1.1.6" + OpenrpcEnum17 Openrpc = "1.1.5" + OpenrpcEnum18 Openrpc = "1.1.4" + OpenrpcEnum19 Openrpc = "1.1.3" + OpenrpcEnum20 Openrpc = "1.1.2" + OpenrpcEnum21 Openrpc = "1.1.1" + OpenrpcEnum22 Openrpc = "1.1.0" + OpenrpcEnum23 Openrpc = "1.0.0" + OpenrpcEnum24 Openrpc = "1.0.0-rc0" + OpenrpcEnum25 Openrpc = "1.0.0-rc1" +) +type InfoObjectProperties string +type InfoObjectDescription string +type InfoObjectTermsOfService string +type InfoObjectVersion string +type ContactObjectName string +type ContactObjectEmail string +type ContactObjectUrl string +type SpecificationExtension interface{} +type ContactObject struct { + Name *ContactObjectName `json:"name,omitempty"` + Email *ContactObjectEmail `json:"email,omitempty"` + Url *ContactObjectUrl `json:"url,omitempty"` +} +type LicenseObjectName string +type LicenseObjectUrl string +type LicenseObject struct { + Name *LicenseObjectName `json:"name,omitempty"` + Url *LicenseObjectUrl `json:"url,omitempty"` +} +type InfoObject struct { + Title *InfoObjectProperties `json:"title"` + Description *InfoObjectDescription `json:"description,omitempty"` + TermsOfService *InfoObjectTermsOfService `json:"termsOfService,omitempty"` + Version *InfoObjectVersion `json:"version"` + Contact *ContactObject `json:"contact,omitempty"` + License *LicenseObject `json:"license,omitempty"` +} +type ExternalDocumentationObjectDescription string +type ExternalDocumentationObjectUrl string +// information about external documentation +type ExternalDocumentationObject struct { + Description *ExternalDocumentationObjectDescription `json:"description,omitempty"` + Url *ExternalDocumentationObjectUrl `json:"url"` +} +type ServerObjectUrl string +type ServerObjectName string +type ServerObjectDescription string +type ServerObjectSummary string +type ServerObjectVariableDefault string +type ServerObjectVariableDescription string +type ServerObjectVariableEnumItem string +type ServerObjectVariableEnum []ServerObjectVariableEnumItem +type ServerObjectVariable struct { + Default *ServerObjectVariableDefault `json:"default"` + Description *ServerObjectVariableDescription `json:"description,omitempty"` + Enum *ServerObjectVariableEnum `json:"enum,omitempty"` +} +type ServerObjectVariables map[string]interface{} +type ServerObject struct { + Url *ServerObjectUrl `json:"url"` + Name *ServerObjectName `json:"name,omitempty"` + Description *ServerObjectDescription `json:"description,omitempty"` + Summary *ServerObjectSummary `json:"summary,omitempty"` + Variables *ServerObjectVariables `json:"variables,omitempty"` +} +type AlwaysFalse interface{} +type Servers []ServerObject +// The cannonical name for the method. The name MUST be unique within the methods array. +type MethodObjectName string +// A verbose explanation of the method behavior. GitHub Flavored Markdown syntax MAY be used for rich text representation. +type MethodObjectDescription string +// A short summary of what the method does. +type MethodObjectSummary string +type TagObjectName string +type TagObjectDescription string +type TagObject struct { + Name *TagObjectName `json:"name"` + Description *TagObjectDescription `json:"description,omitempty"` + ExternalDocs *ExternalDocumentationObject `json:"externalDocs,omitempty"` +} +type Ref string +type ReferenceObject struct { + Ref *Ref `json:"$ref"` +} +type TagOrReference struct { + TagObject *TagObject + ReferenceObject *ReferenceObject +} +// UnmarshalJSON implements the json Unmarshaler interface. +// This implementation DOES NOT assert that ONE AND ONLY ONE +// of the simple properties is satisfied; it lazily uses the first one that is satisfied. +// Ergo, it will not return an error if more than one property is valid. +func (o *TagOrReference) UnmarshalJSON(bytes []byte) error { + var myTagObject TagObject + if err := json.Unmarshal(bytes, &myTagObject); err == nil { + o.TagObject = &myTagObject + return nil + } + var myReferenceObject ReferenceObject + if err := json.Unmarshal(bytes, &myReferenceObject); err == nil { + o.ReferenceObject = &myReferenceObject + return nil + } + return errors.New("failed to unmarshal one of the object properties") +} +func (o TagOrReference) MarshalJSON() ([]byte, error) { + if o.TagObject != nil { + return json.Marshal(o.TagObject) + } + if o.ReferenceObject != nil { + return json.Marshal(o.ReferenceObject) + } + return nil, errors.New("failed to marshal any one of the object properties") +} +type MethodObjectTags []TagOrReference +// Format the server expects the params. Defaults to 'either'. +// +// --- Default --- +// +// either +type MethodObjectParamStructure string +const ( + MethodObjectParamStructureEnum0 MethodObjectParamStructure = "by-position" + MethodObjectParamStructureEnum1 MethodObjectParamStructure = "by-name" + MethodObjectParamStructureEnum2 MethodObjectParamStructure = "either" +) +type ContentDescriptorObjectName string +type ContentDescriptorObjectDescription string +type ContentDescriptorObjectSummary string +type Id string +type Schema string +type Comment string +type Title string +type Description string +type AlwaysTrue interface{} +type ReadOnly bool +type Examples []AlwaysTrue +type MultipleOf float64 +type Maximum float64 +type ExclusiveMaximum float64 +type Minimum float64 +type ExclusiveMinimum float64 +type NonNegativeInteger int64 +type NonNegativeIntegerDefaultZero int64 +type Pattern string +type SchemaArray []JSONSchema +// +// --- Default --- +// +// true +type Items struct { + JSONSchema *JSONSchema + SchemaArray *SchemaArray +} +func (a *Items) UnmarshalJSON(bytes []byte) error { + var ok bool + var myJSONSchema JSONSchema + if err := json.Unmarshal(bytes, &myJSONSchema); err == nil { + ok = true + a.JSONSchema = &myJSONSchema + } + var mySchemaArray SchemaArray + if err := json.Unmarshal(bytes, &mySchemaArray); err == nil { + ok = true + a.SchemaArray = &mySchemaArray + } + if ok { + return nil + } + return errors.New("failed to unmarshal any of the object properties") +} +func (o Items) MarshalJSON() ([]byte, error) { + out := []interface{}{} + if o.JSONSchema != nil { + out = append(out, o.JSONSchema) + } + if o.SchemaArray != nil { + out = append(out, o.SchemaArray) + } + return json.Marshal(out) +} +type UniqueItems bool +type StringDoaGddGA string +// +// --- Default --- +// +// [] +type StringArray []StringDoaGddGA +// +// --- Default --- +// +// {} +type Definitions map[string]interface{} +// +// --- Default --- +// +// {} +type Properties map[string]interface{} +type PropertyNames interface{} +// +// --- Default --- +// +// {} +type PatternProperties map[string]interface{} +type DependenciesSet struct { + JSONSchema *JSONSchema + StringArray *StringArray +} +func (a *DependenciesSet) UnmarshalJSON(bytes []byte) error { + var ok bool + var myJSONSchema JSONSchema + if err := json.Unmarshal(bytes, &myJSONSchema); err == nil { + ok = true + a.JSONSchema = &myJSONSchema + } + var myStringArray StringArray + if err := json.Unmarshal(bytes, &myStringArray); err == nil { + ok = true + a.StringArray = &myStringArray + } + if ok { + return nil + } + return errors.New("failed to unmarshal any of the object properties") +} +func (o DependenciesSet) MarshalJSON() ([]byte, error) { + out := []interface{}{} + if o.JSONSchema != nil { + out = append(out, o.JSONSchema) + } + if o.StringArray != nil { + out = append(out, o.StringArray) + } + return json.Marshal(out) +} +type Dependencies map[string]interface{} +type Enum []AlwaysTrue +type SimpleTypes string +const ( + SimpleTypesEnum0 SimpleTypes = "array" + SimpleTypesEnum1 SimpleTypes = "boolean" + SimpleTypesEnum2 SimpleTypes = "integer" + SimpleTypesEnum3 SimpleTypes = "null" + SimpleTypesEnum4 SimpleTypes = "number" + SimpleTypesEnum5 SimpleTypes = "object" + SimpleTypesEnum6 SimpleTypes = "string" +) +type ArrayOfSimpleTypes []SimpleTypes +type Type struct { + SimpleTypes *SimpleTypes + ArrayOfSimpleTypes *ArrayOfSimpleTypes +} +func (a *Type) UnmarshalJSON(bytes []byte) error { + var ok bool + var mySimpleTypes SimpleTypes + if err := json.Unmarshal(bytes, &mySimpleTypes); err == nil { + ok = true + a.SimpleTypes = &mySimpleTypes + } + var myArrayOfSimpleTypes ArrayOfSimpleTypes + if err := json.Unmarshal(bytes, &myArrayOfSimpleTypes); err == nil { + ok = true + a.ArrayOfSimpleTypes = &myArrayOfSimpleTypes + } + if ok { + return nil + } + return errors.New("failed to unmarshal any of the object properties") +} +func (o Type) MarshalJSON() ([]byte, error) { + out := []interface{}{} + if o.SimpleTypes != nil { + out = append(out, o.SimpleTypes) + } + if o.ArrayOfSimpleTypes != nil { + out = append(out, o.ArrayOfSimpleTypes) + } + return json.Marshal(out) +} +type Format string +type ContentMediaType string +type ContentEncoding string +type JSONSchemaObject struct { + Id *Id `json:"$id,omitempty"` + Schema *Schema `json:"$schema,omitempty"` + Ref *Ref `json:"$ref,omitempty"` + Comment *Comment `json:"$comment,omitempty"` + Title *Title `json:"title,omitempty"` + Description *Description `json:"description,omitempty"` + Default *AlwaysTrue `json:"default,omitempty"` + ReadOnly *ReadOnly `json:"readOnly,omitempty"` + Examples *Examples `json:"examples,omitempty"` + MultipleOf *MultipleOf `json:"multipleOf,omitempty"` + Maximum *Maximum `json:"maximum,omitempty"` + ExclusiveMaximum *ExclusiveMaximum `json:"exclusiveMaximum,omitempty"` + Minimum *Minimum `json:"minimum,omitempty"` + ExclusiveMinimum *ExclusiveMinimum `json:"exclusiveMinimum,omitempty"` + MaxLength *NonNegativeInteger `json:"maxLength,omitempty"` + MinLength *NonNegativeIntegerDefaultZero `json:"minLength,omitempty"` + Pattern *Pattern `json:"pattern,omitempty"` + AdditionalItems *JSONSchema `json:"additionalItems,omitempty"` + Items *Items `json:"items,omitempty"` + MaxItems *NonNegativeInteger `json:"maxItems,omitempty"` + MinItems *NonNegativeIntegerDefaultZero `json:"minItems,omitempty"` + UniqueItems *UniqueItems `json:"uniqueItems,omitempty"` + Contains *JSONSchema `json:"contains,omitempty"` + MaxProperties *NonNegativeInteger `json:"maxProperties,omitempty"` + MinProperties *NonNegativeIntegerDefaultZero `json:"minProperties,omitempty"` + Required *StringArray `json:"required,omitempty"` + AdditionalProperties *JSONSchema `json:"additionalProperties,omitempty"` + Definitions *Definitions `json:"definitions,omitempty"` + Properties *Properties `json:"properties,omitempty"` + PatternProperties *PatternProperties `json:"patternProperties,omitempty"` + Dependencies *Dependencies `json:"dependencies,omitempty"` + PropertyNames *JSONSchema `json:"propertyNames,omitempty"` + Const *AlwaysTrue `json:"const,omitempty"` + Enum *Enum `json:"enum,omitempty"` + Type *Type `json:"type,omitempty"` + Format *Format `json:"format,omitempty"` + ContentMediaType *ContentMediaType `json:"contentMediaType,omitempty"` + ContentEncoding *ContentEncoding `json:"contentEncoding,omitempty"` + If *JSONSchema `json:"if,omitempty"` + Then *JSONSchema `json:"then,omitempty"` + Else *JSONSchema `json:"else,omitempty"` + AllOf *SchemaArray `json:"allOf,omitempty"` + AnyOf *SchemaArray `json:"anyOf,omitempty"` + OneOf *SchemaArray `json:"oneOf,omitempty"` + Not *JSONSchema `json:"not,omitempty"` +} +// Always valid if true. Never valid if false. Is constant. +type JSONSchemaBoolean bool +// +// --- Default --- +// +// {} +type JSONSchema struct { + JSONSchemaObject *JSONSchemaObject + JSONSchemaBoolean *JSONSchemaBoolean +} +// UnmarshalJSON implements the json Unmarshaler interface. +// This implementation DOES NOT assert that ONE AND ONLY ONE +// of the simple properties is satisfied; it lazily uses the first one that is satisfied. +// Ergo, it will not return an error if more than one property is valid. +func (o *JSONSchema) UnmarshalJSON(bytes []byte) error { + var myJSONSchemaObject JSONSchemaObject + if err := json.Unmarshal(bytes, &myJSONSchemaObject); err == nil { + o.JSONSchemaObject = &myJSONSchemaObject + return nil + } + var myJSONSchemaBoolean JSONSchemaBoolean + if err := json.Unmarshal(bytes, &myJSONSchemaBoolean); err == nil { + o.JSONSchemaBoolean = &myJSONSchemaBoolean + return nil + } + return errors.New("failed to unmarshal one of the object properties") +} +func (o JSONSchema) MarshalJSON() ([]byte, error) { + if o.JSONSchemaObject != nil { + return json.Marshal(o.JSONSchemaObject) + } + if o.JSONSchemaBoolean != nil { + return json.Marshal(o.JSONSchemaBoolean) + } + return nil, errors.New("failed to marshal any one of the object properties") +} +type ContentDescriptorObjectRequired bool +type ContentDescriptorObjectDeprecated bool +type ContentDescriptorObject struct { + Name *ContentDescriptorObjectName `json:"name"` + Description *ContentDescriptorObjectDescription `json:"description,omitempty"` + Summary *ContentDescriptorObjectSummary `json:"summary,omitempty"` + Schema *JSONSchema `json:"schema"` + Required *ContentDescriptorObjectRequired `json:"required,omitempty"` + Deprecated *ContentDescriptorObjectDeprecated `json:"deprecated,omitempty"` +} +type ContentDescriptorOrReference struct { + ContentDescriptorObject *ContentDescriptorObject + ReferenceObject *ReferenceObject +} +// UnmarshalJSON implements the json Unmarshaler interface. +// This implementation DOES NOT assert that ONE AND ONLY ONE +// of the simple properties is satisfied; it lazily uses the first one that is satisfied. +// Ergo, it will not return an error if more than one property is valid. +func (o *ContentDescriptorOrReference) UnmarshalJSON(bytes []byte) error { + var myContentDescriptorObject ContentDescriptorObject + if err := json.Unmarshal(bytes, &myContentDescriptorObject); err == nil { + o.ContentDescriptorObject = &myContentDescriptorObject + return nil + } + var myReferenceObject ReferenceObject + if err := json.Unmarshal(bytes, &myReferenceObject); err == nil { + o.ReferenceObject = &myReferenceObject + return nil + } + return errors.New("failed to unmarshal one of the object properties") +} +func (o ContentDescriptorOrReference) MarshalJSON() ([]byte, error) { + if o.ContentDescriptorObject != nil { + return json.Marshal(o.ContentDescriptorObject) + } + if o.ReferenceObject != nil { + return json.Marshal(o.ReferenceObject) + } + return nil, errors.New("failed to marshal any one of the object properties") +} +type MethodObjectParams []ContentDescriptorOrReference +type MethodObjectResult struct { + ContentDescriptorObject *ContentDescriptorObject + ReferenceObject *ReferenceObject +} +// UnmarshalJSON implements the json Unmarshaler interface. +// This implementation DOES NOT assert that ONE AND ONLY ONE +// of the simple properties is satisfied; it lazily uses the first one that is satisfied. +// Ergo, it will not return an error if more than one property is valid. +func (o *MethodObjectResult) UnmarshalJSON(bytes []byte) error { + var myContentDescriptorObject ContentDescriptorObject + if err := json.Unmarshal(bytes, &myContentDescriptorObject); err == nil { + o.ContentDescriptorObject = &myContentDescriptorObject + return nil + } + var myReferenceObject ReferenceObject + if err := json.Unmarshal(bytes, &myReferenceObject); err == nil { + o.ReferenceObject = &myReferenceObject + return nil + } + return errors.New("failed to unmarshal one of the object properties") +} +func (o MethodObjectResult) MarshalJSON() ([]byte, error) { + if o.ContentDescriptorObject != nil { + return json.Marshal(o.ContentDescriptorObject) + } + if o.ReferenceObject != nil { + return json.Marshal(o.ReferenceObject) + } + return nil, errors.New("failed to marshal any one of the object properties") +} +// A Number that indicates the error type that occurred. This MUST be an integer. The error codes from and including -32768 to -32000 are reserved for pre-defined errors. These pre-defined errors SHOULD be assumed to be returned from any JSON-RPC api. +type ErrorObjectCode int64 +// A String providing a short description of the error. The message SHOULD be limited to a concise single sentence. +type ErrorObjectMessage string +// A Primitive or Structured value that contains additional information about the error. This may be omitted. The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.). +type ErrorObjectData interface{} +// Defines an application level error. +type ErrorObject struct { + Code *ErrorObjectCode `json:"code"` + Message *ErrorObjectMessage `json:"message"` + Data *ErrorObjectData `json:"data,omitempty"` +} +type ErrorOrReference struct { + ErrorObject *ErrorObject + ReferenceObject *ReferenceObject +} +// UnmarshalJSON implements the json Unmarshaler interface. +// This implementation DOES NOT assert that ONE AND ONLY ONE +// of the simple properties is satisfied; it lazily uses the first one that is satisfied. +// Ergo, it will not return an error if more than one property is valid. +func (o *ErrorOrReference) UnmarshalJSON(bytes []byte) error { + var myErrorObject ErrorObject + if err := json.Unmarshal(bytes, &myErrorObject); err == nil { + o.ErrorObject = &myErrorObject + return nil + } + var myReferenceObject ReferenceObject + if err := json.Unmarshal(bytes, &myReferenceObject); err == nil { + o.ReferenceObject = &myReferenceObject + return nil + } + return errors.New("failed to unmarshal one of the object properties") +} +func (o ErrorOrReference) MarshalJSON() ([]byte, error) { + if o.ErrorObject != nil { + return json.Marshal(o.ErrorObject) + } + if o.ReferenceObject != nil { + return json.Marshal(o.ReferenceObject) + } + return nil, errors.New("failed to marshal any one of the object properties") +} +// Defines an application level error. +type MethodObjectErrors []ErrorOrReference +type LinkObjectName string +type LinkObjectSummary string +type LinkObjectMethod string +type LinkObjectDescription string +type LinkObjectParams interface{} +type LinkObjectServer struct { + Url *ServerObjectUrl `json:"url"` + Name *ServerObjectName `json:"name,omitempty"` + Description *ServerObjectDescription `json:"description,omitempty"` + Summary *ServerObjectSummary `json:"summary,omitempty"` + Variables *ServerObjectVariables `json:"variables,omitempty"` +} +type LinkObject struct { + Name *LinkObjectName `json:"name,omitempty"` + Summary *LinkObjectSummary `json:"summary,omitempty"` + Method *LinkObjectMethod `json:"method,omitempty"` + Description *LinkObjectDescription `json:"description,omitempty"` + Params *LinkObjectParams `json:"params,omitempty"` + Server *LinkObjectServer `json:"server,omitempty"` +} +type LinkOrReference struct { + LinkObject *LinkObject + ReferenceObject *ReferenceObject +} +// UnmarshalJSON implements the json Unmarshaler interface. +// This implementation DOES NOT assert that ONE AND ONLY ONE +// of the simple properties is satisfied; it lazily uses the first one that is satisfied. +// Ergo, it will not return an error if more than one property is valid. +func (o *LinkOrReference) UnmarshalJSON(bytes []byte) error { + var myLinkObject LinkObject + if err := json.Unmarshal(bytes, &myLinkObject); err == nil { + o.LinkObject = &myLinkObject + return nil + } + var myReferenceObject ReferenceObject + if err := json.Unmarshal(bytes, &myReferenceObject); err == nil { + o.ReferenceObject = &myReferenceObject + return nil + } + return errors.New("failed to unmarshal one of the object properties") +} +func (o LinkOrReference) MarshalJSON() ([]byte, error) { + if o.LinkObject != nil { + return json.Marshal(o.LinkObject) + } + if o.ReferenceObject != nil { + return json.Marshal(o.ReferenceObject) + } + return nil, errors.New("failed to marshal any one of the object properties") +} +type MethodObjectLinks []LinkOrReference +type ExamplePairingObjectName string +type ExamplePairingObjectDescription string +type ExampleObjectSummary string +type ExampleObjectValue interface{} +type ExampleObjectDescription string +type ExampleObjectName string +type ExampleObject struct { + Summary *ExampleObjectSummary `json:"summary,omitempty"` + Value *ExampleObjectValue `json:"value"` + Description *ExampleObjectDescription `json:"description,omitempty"` + Name *ExampleObjectName `json:"name"` +} +type ExampleOrReference struct { + ExampleObject *ExampleObject + ReferenceObject *ReferenceObject +} +// UnmarshalJSON implements the json Unmarshaler interface. +// This implementation DOES NOT assert that ONE AND ONLY ONE +// of the simple properties is satisfied; it lazily uses the first one that is satisfied. +// Ergo, it will not return an error if more than one property is valid. +func (o *ExampleOrReference) UnmarshalJSON(bytes []byte) error { + var myExampleObject ExampleObject + if err := json.Unmarshal(bytes, &myExampleObject); err == nil { + o.ExampleObject = &myExampleObject + return nil + } + var myReferenceObject ReferenceObject + if err := json.Unmarshal(bytes, &myReferenceObject); err == nil { + o.ReferenceObject = &myReferenceObject + return nil + } + return errors.New("failed to unmarshal one of the object properties") +} +func (o ExampleOrReference) MarshalJSON() ([]byte, error) { + if o.ExampleObject != nil { + return json.Marshal(o.ExampleObject) + } + if o.ReferenceObject != nil { + return json.Marshal(o.ReferenceObject) + } + return nil, errors.New("failed to marshal any one of the object properties") +} +type ExamplePairingObjectParams []ExampleOrReference +type ExamplePairingObjectResult struct { + ExampleObject *ExampleObject + ReferenceObject *ReferenceObject +} +// UnmarshalJSON implements the json Unmarshaler interface. +// This implementation DOES NOT assert that ONE AND ONLY ONE +// of the simple properties is satisfied; it lazily uses the first one that is satisfied. +// Ergo, it will not return an error if more than one property is valid. +func (o *ExamplePairingObjectResult) UnmarshalJSON(bytes []byte) error { + var myExampleObject ExampleObject + if err := json.Unmarshal(bytes, &myExampleObject); err == nil { + o.ExampleObject = &myExampleObject + return nil + } + var myReferenceObject ReferenceObject + if err := json.Unmarshal(bytes, &myReferenceObject); err == nil { + o.ReferenceObject = &myReferenceObject + return nil + } + return errors.New("failed to unmarshal one of the object properties") +} +func (o ExamplePairingObjectResult) MarshalJSON() ([]byte, error) { + if o.ExampleObject != nil { + return json.Marshal(o.ExampleObject) + } + if o.ReferenceObject != nil { + return json.Marshal(o.ReferenceObject) + } + return nil, errors.New("failed to marshal any one of the object properties") +} +type ExamplePairingObject struct { + Name *ExamplePairingObjectName `json:"name"` + Description *ExamplePairingObjectDescription `json:"description,omitempty"` + Params *ExamplePairingObjectParams `json:"params"` + Result *ExamplePairingObjectResult `json:"result,omitempty"` +} +type ExamplePairingOrReference struct { + ExamplePairingObject *ExamplePairingObject + ReferenceObject *ReferenceObject +} +// UnmarshalJSON implements the json Unmarshaler interface. +// This implementation DOES NOT assert that ONE AND ONLY ONE +// of the simple properties is satisfied; it lazily uses the first one that is satisfied. +// Ergo, it will not return an error if more than one property is valid. +func (o *ExamplePairingOrReference) UnmarshalJSON(bytes []byte) error { + var myExamplePairingObject ExamplePairingObject + if err := json.Unmarshal(bytes, &myExamplePairingObject); err == nil { + o.ExamplePairingObject = &myExamplePairingObject + return nil + } + var myReferenceObject ReferenceObject + if err := json.Unmarshal(bytes, &myReferenceObject); err == nil { + o.ReferenceObject = &myReferenceObject + return nil + } + return errors.New("failed to unmarshal one of the object properties") +} +func (o ExamplePairingOrReference) MarshalJSON() ([]byte, error) { + if o.ExamplePairingObject != nil { + return json.Marshal(o.ExamplePairingObject) + } + if o.ReferenceObject != nil { + return json.Marshal(o.ReferenceObject) + } + return nil, errors.New("failed to marshal any one of the object properties") +} +type MethodObjectExamples []ExamplePairingOrReference +type MethodObjectDeprecated bool +type MethodObject struct { + Name *MethodObjectName `json:"name"` + Description *MethodObjectDescription `json:"description,omitempty"` + Summary *MethodObjectSummary `json:"summary,omitempty"` + Servers *Servers `json:"servers,omitempty"` + Tags *MethodObjectTags `json:"tags,omitempty"` + ParamStructure *MethodObjectParamStructure `json:"paramStructure,omitempty"` + Params *MethodObjectParams `json:"params"` + Result *MethodObjectResult `json:"result,omitempty"` + Errors *MethodObjectErrors `json:"errors,omitempty"` + Links *MethodObjectLinks `json:"links,omitempty"` + Examples *MethodObjectExamples `json:"examples,omitempty"` + Deprecated *MethodObjectDeprecated `json:"deprecated,omitempty"` + ExternalDocs *ExternalDocumentationObject `json:"externalDocs,omitempty"` +} +type MethodOrReference struct { + MethodObject *MethodObject + ReferenceObject *ReferenceObject +} +// UnmarshalJSON implements the json Unmarshaler interface. +// This implementation DOES NOT assert that ONE AND ONLY ONE +// of the simple properties is satisfied; it lazily uses the first one that is satisfied. +// Ergo, it will not return an error if more than one property is valid. +func (o *MethodOrReference) UnmarshalJSON(bytes []byte) error { + var myMethodObject MethodObject + if err := json.Unmarshal(bytes, &myMethodObject); err == nil { + o.MethodObject = &myMethodObject + return nil + } + var myReferenceObject ReferenceObject + if err := json.Unmarshal(bytes, &myReferenceObject); err == nil { + o.ReferenceObject = &myReferenceObject + return nil + } + return errors.New("failed to unmarshal one of the object properties") +} +func (o MethodOrReference) MarshalJSON() ([]byte, error) { + if o.MethodObject != nil { + return json.Marshal(o.MethodObject) + } + if o.ReferenceObject != nil { + return json.Marshal(o.ReferenceObject) + } + return nil, errors.New("failed to marshal any one of the object properties") +} +type Methods []MethodOrReference +type SchemaComponents map[string]interface{} +type LinkComponents map[string]interface{} +type ErrorComponents map[string]interface{} +type ExampleComponents map[string]interface{} +type ExamplePairingComponents map[string]interface{} +type ContentDescriptorComponents map[string]interface{} +type TagComponents map[string]interface{} +type Components struct { + Schemas *SchemaComponents `json:"schemas,omitempty"` + Links *LinkComponents `json:"links,omitempty"` + Errors *ErrorComponents `json:"errors,omitempty"` + Examples *ExampleComponents `json:"examples,omitempty"` + ExamplePairings *ExamplePairingComponents `json:"examplePairings,omitempty"` + ContentDescriptors *ContentDescriptorComponents `json:"contentDescriptors,omitempty"` + Tags *TagComponents `json:"tags,omitempty"` +} +// JSON Schema URI (used by some editors) +// +// --- Default --- +// +// https://meta.open-rpc.org/ +type MetaSchema string +type OpenrpcDocument struct { + Openrpc *Openrpc `json:"openrpc"` + Info *InfoObject `json:"info"` + ExternalDocs *ExternalDocumentationObject `json:"externalDocs,omitempty"` + Servers *Servers `json:"servers,omitempty"` + Methods *Methods `json:"methods"` + Components *Components `json:"components,omitempty"` + Schema *MetaSchema `json:"$schema,omitempty"` +} + +const RawOpenrpcDocument = "{\"$schema\":\"https://meta.json-schema.tools/\",\"$id\":\"https://meta.open-rpc.org/\",\"title\":\"openrpcDocument\",\"type\":\"object\",\"required\":[\"info\",\"methods\",\"openrpc\"],\"additionalProperties\":false,\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"openrpc\":{\"title\":\"openrpc\",\"type\":\"string\",\"enum\":[\"1.3.2\",\"1.3.1\",\"1.3.0\",\"1.2.6\",\"1.2.5\",\"1.2.4\",\"1.2.3\",\"1.2.2\",\"1.2.1\",\"1.2.0\",\"1.1.12\",\"1.1.11\",\"1.1.10\",\"1.1.9\",\"1.1.8\",\"1.1.7\",\"1.1.6\",\"1.1.5\",\"1.1.4\",\"1.1.3\",\"1.1.2\",\"1.1.1\",\"1.1.0\",\"1.0.0\",\"1.0.0-rc0\",\"1.0.0-rc1\"]},\"info\":{\"$ref\":\"#/definitions/infoObject\"},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocumentationObject\"},\"servers\":{\"title\":\"servers\",\"type\":\"array\",\"additionalItems\":false,\"items\":{\"$ref\":\"#/definitions/serverObject\"}},\"methods\":{\"title\":\"methods\",\"type\":\"array\",\"additionalItems\":false,\"items\":{\"title\":\"methodOrReference\",\"oneOf\":[{\"$ref\":\"#/definitions/methodObject\"},{\"$ref\":\"#/definitions/referenceObject\"}]}},\"components\":{\"title\":\"components\",\"type\":\"object\",\"properties\":{\"schemas\":{\"title\":\"schemaComponents\",\"type\":\"object\",\"patternProperties\":{\"[0-z]+\":{\"$ref\":\"#/definitions/JSONSchema\"}}},\"links\":{\"title\":\"linkComponents\",\"type\":\"object\",\"patternProperties\":{\"[0-z]+\":{\"$ref\":\"#/definitions/linkObject\"}}},\"errors\":{\"title\":\"errorComponents\",\"type\":\"object\",\"patternProperties\":{\"[0-z]+\":{\"$ref\":\"#/definitions/errorObject\"}}},\"examples\":{\"title\":\"exampleComponents\",\"type\":\"object\",\"patternProperties\":{\"[0-z]+\":{\"$ref\":\"#/definitions/exampleObject\"}}},\"examplePairings\":{\"title\":\"examplePairingComponents\",\"type\":\"object\",\"patternProperties\":{\"[0-z]+\":{\"$ref\":\"#/definitions/examplePairingObject\"}}},\"contentDescriptors\":{\"title\":\"contentDescriptorComponents\",\"type\":\"object\",\"patternProperties\":{\"[0-z]+\":{\"$ref\":\"#/definitions/contentDescriptorObject\"}}},\"tags\":{\"title\":\"tagComponents\",\"type\":\"object\",\"patternProperties\":{\"[0-z]+\":{\"$ref\":\"#/definitions/tagObject\"}}}}},\"$schema\":{\"title\":\"metaSchema\",\"description\":\"JSON Schema URI (used by some editors)\",\"type\":\"string\",\"default\":\"https://meta.open-rpc.org/\"}},\"definitions\":{\"specificationExtension\":{\"title\":\"specificationExtension\"},\"JSONSchema\":{\"$ref\":\"https://meta.json-schema.tools\"},\"referenceObject\":{\"title\":\"referenceObject\",\"type\":\"object\",\"additionalProperties\":false,\"required\":[\"$ref\"],\"properties\":{\"$ref\":{\"$ref\":\"https://meta.json-schema.tools/#/definitions/JSONSchemaObject/properties/$ref\"}}},\"errorObject\":{\"title\":\"errorObject\",\"type\":\"object\",\"description\":\"Defines an application level error.\",\"additionalProperties\":false,\"required\":[\"code\",\"message\"],\"properties\":{\"code\":{\"title\":\"errorObjectCode\",\"description\":\"A Number that indicates the error type that occurred. This MUST be an integer. The error codes from and including -32768 to -32000 are reserved for pre-defined errors. These pre-defined errors SHOULD be assumed to be returned from any JSON-RPC api.\",\"type\":\"integer\"},\"message\":{\"title\":\"errorObjectMessage\",\"description\":\"A String providing a short description of the error. The message SHOULD be limited to a concise single sentence.\",\"type\":\"string\"},\"data\":{\"title\":\"errorObjectData\",\"description\":\"A Primitive or Structured value that contains additional information about the error. This may be omitted. The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.).\"}}},\"licenseObject\":{\"title\":\"licenseObject\",\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"name\":{\"title\":\"licenseObjectName\",\"type\":\"string\"},\"url\":{\"title\":\"licenseObjectUrl\",\"type\":\"string\"}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"contactObject\":{\"title\":\"contactObject\",\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"name\":{\"title\":\"contactObjectName\",\"type\":\"string\"},\"email\":{\"title\":\"contactObjectEmail\",\"type\":\"string\"},\"url\":{\"title\":\"contactObjectUrl\",\"type\":\"string\"}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"infoObject\":{\"title\":\"infoObject\",\"type\":\"object\",\"additionalProperties\":false,\"required\":[\"title\",\"version\"],\"properties\":{\"title\":{\"title\":\"infoObjectProperties\",\"type\":\"string\"},\"description\":{\"title\":\"infoObjectDescription\",\"type\":\"string\"},\"termsOfService\":{\"title\":\"infoObjectTermsOfService\",\"type\":\"string\",\"format\":\"uri\"},\"version\":{\"title\":\"infoObjectVersion\",\"type\":\"string\"},\"contact\":{\"$ref\":\"#/definitions/contactObject\"},\"license\":{\"$ref\":\"#/definitions/licenseObject\"}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"serverObject\":{\"title\":\"serverObject\",\"type\":\"object\",\"required\":[\"url\"],\"additionalProperties\":false,\"properties\":{\"url\":{\"title\":\"serverObjectUrl\",\"type\":\"string\",\"format\":\"uri\"},\"name\":{\"title\":\"serverObjectName\",\"type\":\"string\"},\"description\":{\"title\":\"serverObjectDescription\",\"type\":\"string\"},\"summary\":{\"title\":\"serverObjectSummary\",\"type\":\"string\"},\"variables\":{\"title\":\"serverObjectVariables\",\"type\":\"object\",\"patternProperties\":{\"[0-z]+\":{\"title\":\"serverObjectVariable\",\"type\":\"object\",\"required\":[\"default\"],\"properties\":{\"default\":{\"title\":\"serverObjectVariableDefault\",\"type\":\"string\"},\"description\":{\"title\":\"serverObjectVariableDescription\",\"type\":\"string\"},\"enum\":{\"title\":\"serverObjectVariableEnum\",\"type\":\"array\",\"items\":{\"title\":\"serverObjectVariableEnumItem\",\"type\":\"string\"}}}}}}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"linkObject\":{\"title\":\"linkObject\",\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"name\":{\"title\":\"linkObjectName\",\"type\":\"string\",\"minLength\":1},\"summary\":{\"title\":\"linkObjectSummary\",\"type\":\"string\"},\"method\":{\"title\":\"linkObjectMethod\",\"type\":\"string\"},\"description\":{\"title\":\"linkObjectDescription\",\"type\":\"string\"},\"params\":{\"title\":\"linkObjectParams\"},\"server\":{\"title\":\"linkObjectServer\",\"$ref\":\"#/definitions/serverObject\"}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"externalDocumentationObject\":{\"title\":\"externalDocumentationObject\",\"type\":\"object\",\"additionalProperties\":false,\"description\":\"information about external documentation\",\"required\":[\"url\"],\"properties\":{\"description\":{\"title\":\"externalDocumentationObjectDescription\",\"type\":\"string\"},\"url\":{\"title\":\"externalDocumentationObjectUrl\",\"type\":\"string\",\"format\":\"uri\"}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"methodObject\":{\"title\":\"methodObject\",\"type\":\"object\",\"required\":[\"name\",\"params\"],\"additionalProperties\":false,\"properties\":{\"name\":{\"title\":\"methodObjectName\",\"description\":\"The cannonical name for the method. The name MUST be unique within the methods array.\",\"type\":\"string\",\"minLength\":1},\"description\":{\"title\":\"methodObjectDescription\",\"description\":\"A verbose explanation of the method behavior. GitHub Flavored Markdown syntax MAY be used for rich text representation.\",\"type\":\"string\"},\"summary\":{\"title\":\"methodObjectSummary\",\"description\":\"A short summary of what the method does.\",\"type\":\"string\"},\"servers\":{\"title\":\"servers\",\"type\":\"array\",\"additionalItems\":false,\"items\":{\"$ref\":\"#/definitions/serverObject\"}},\"tags\":{\"title\":\"methodObjectTags\",\"type\":\"array\",\"items\":{\"title\":\"tagOrReference\",\"oneOf\":[{\"$ref\":\"#/definitions/tagObject\"},{\"$ref\":\"#/definitions/referenceObject\"}]}},\"paramStructure\":{\"title\":\"methodObjectParamStructure\",\"type\":\"string\",\"description\":\"Format the server expects the params. Defaults to 'either'.\",\"enum\":[\"by-position\",\"by-name\",\"either\"],\"default\":\"either\"},\"params\":{\"title\":\"methodObjectParams\",\"type\":\"array\",\"items\":{\"title\":\"contentDescriptorOrReference\",\"oneOf\":[{\"$ref\":\"#/definitions/contentDescriptorObject\"},{\"$ref\":\"#/definitions/referenceObject\"}]}},\"result\":{\"title\":\"methodObjectResult\",\"oneOf\":[{\"$ref\":\"#/definitions/contentDescriptorObject\"},{\"$ref\":\"#/definitions/referenceObject\"}]},\"errors\":{\"title\":\"methodObjectErrors\",\"description\":\"Defines an application level error.\",\"type\":\"array\",\"items\":{\"title\":\"errorOrReference\",\"oneOf\":[{\"$ref\":\"#/definitions/errorObject\"},{\"$ref\":\"#/definitions/referenceObject\"}]}},\"links\":{\"title\":\"methodObjectLinks\",\"type\":\"array\",\"items\":{\"title\":\"linkOrReference\",\"oneOf\":[{\"$ref\":\"#/definitions/linkObject\"},{\"$ref\":\"#/definitions/referenceObject\"}]}},\"examples\":{\"title\":\"methodObjectExamples\",\"type\":\"array\",\"items\":{\"title\":\"examplePairingOrReference\",\"oneOf\":[{\"$ref\":\"#/definitions/examplePairingObject\"},{\"$ref\":\"#/definitions/referenceObject\"}]}},\"deprecated\":{\"title\":\"methodObjectDeprecated\",\"type\":\"boolean\",\"default\":false},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocumentationObject\"}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"tagObject\":{\"title\":\"tagObject\",\"type\":\"object\",\"additionalProperties\":false,\"required\":[\"name\"],\"properties\":{\"name\":{\"title\":\"tagObjectName\",\"type\":\"string\",\"minLength\":1},\"description\":{\"title\":\"tagObjectDescription\",\"type\":\"string\"},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocumentationObject\"}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"exampleObject\":{\"title\":\"exampleObject\",\"type\":\"object\",\"required\":[\"name\",\"value\"],\"properties\":{\"summary\":{\"title\":\"exampleObjectSummary\",\"type\":\"string\"},\"value\":{\"title\":\"exampleObjectValue\"},\"description\":{\"title\":\"exampleObjectDescription\",\"type\":\"string\"},\"name\":{\"title\":\"exampleObjectName\",\"type\":\"string\",\"minLength\":1}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"examplePairingObject\":{\"title\":\"examplePairingObject\",\"type\":\"object\",\"required\":[\"name\",\"params\"],\"properties\":{\"name\":{\"title\":\"examplePairingObjectName\",\"type\":\"string\",\"minLength\":1},\"description\":{\"title\":\"examplePairingObjectDescription\",\"type\":\"string\"},\"params\":{\"title\":\"examplePairingObjectParams\",\"type\":\"array\",\"items\":{\"title\":\"exampleOrReference\",\"oneOf\":[{\"$ref\":\"#/definitions/exampleObject\"},{\"$ref\":\"#/definitions/referenceObject\"}]}},\"result\":{\"title\":\"examplePairingObjectResult\",\"oneOf\":[{\"$ref\":\"#/definitions/exampleObject\"},{\"$ref\":\"#/definitions/referenceObject\"}]}}},\"contentDescriptorObject\":{\"title\":\"contentDescriptorObject\",\"type\":\"object\",\"additionalProperties\":false,\"required\":[\"name\",\"schema\"],\"properties\":{\"name\":{\"title\":\"contentDescriptorObjectName\",\"type\":\"string\",\"minLength\":1},\"description\":{\"title\":\"contentDescriptorObjectDescription\",\"type\":\"string\"},\"summary\":{\"title\":\"contentDescriptorObjectSummary\",\"type\":\"string\"},\"schema\":{\"$ref\":\"#/definitions/JSONSchema\"},\"required\":{\"title\":\"contentDescriptorObjectRequired\",\"type\":\"boolean\",\"default\":false},\"deprecated\":{\"title\":\"contentDescriptorObjectDeprecated\",\"type\":\"boolean\",\"default\":false}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/specificationExtension\"}}}}}" diff --git a/generated/packages/go/v1_4/v1_4.go b/generated/packages/go/v1_4/v1_4.go new file mode 100644 index 0000000..47e6415 --- /dev/null +++ b/generated/packages/go/v1_4/v1_4.go @@ -0,0 +1,807 @@ +package v1_4 + +import "encoding/json" +import "errors" +// This string MUST be the [semantic version number](https://semver.org/spec/v2.0.0.html) of the [OpenRPC Specification version](#versions) that the OpenRPC document uses. The `openrpc` field SHOULD be used by tooling specifications and clients to interpret the OpenRPC document. This is *not* related to the API [`info.version`](#info-version) string. +type Openrpc string +// The title of the application. +type InfoObjectTitle string +// A verbose description of the application. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +type InfoObjectDescription string +// A URL to the Terms of Service for the API. MUST be in the format of a URL. +type InfoObjectTermsOfService string +// The version of the OpenRPC document (which is distinct from the [OpenRPC Specification version](#openrpc-document-openrpc) or the API implementation version). +type InfoObjectVersion string +// The identifying name of the contact person/organization. +type ContactObjectName string +// The email address of the contact person/organization. MUST be in the format of an email address. +type ContactObjectEmail string +// The URL pointing to the contact information. MUST be in the format of a URL. +type ContactObjectUrl string +// This object MAY be extended with [Specification Extensions](#specification-extensions). +type SpecificationExtension interface{} +// Contact information for the exposed API. +type ContactObject struct { + Name *ContactObjectName `json:"name,omitempty"` + Email *ContactObjectEmail `json:"email,omitempty"` + Url *ContactObjectUrl `json:"url,omitempty"` +} +// The license name used for the API. +type LicenseObjectName string +// A URL to the license used for the API. MUST be in the format of a URL. +type LicenseObjectUrl string +// License information for the exposed API. +type LicenseObject struct { + Name *LicenseObjectName `json:"name,omitempty"` + Url *LicenseObjectUrl `json:"url,omitempty"` +} +// The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience. +type InfoObject interface{} +// A verbose explanation of the documentation. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +type ExternalDocumentationObjectDescription string +// The URL for the target documentation. Value MUST be in the format of a URL. +type ExternalDocumentationObjectUrl string +// Additional external documentation for this tag. +type ExternalDocumentationObject struct { + Description *ExternalDocumentationObjectDescription `json:"description,omitempty"` + Url *ExternalDocumentationObjectUrl `json:"url"` +} +// A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenRPC document is being served. [Server Variables](#server-variables) are passed into the [Runtime Expression](#runtime-expression) to produce a server URL. +type ServerObjectUrl string +// An optional string describing the name of the server. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +type ServerObjectName string +// An optional string describing the host designated by the URL. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +type ServerObjectDescription string +// A short summary of what the server is. +type ServerObjectSummary string +// The default value to use for substitution, which SHALL be sent if an alternate value is _not_ supplied. Note this behavior is different than the [Schema Object's](#schema-object) treatment of default values, because in those cases parameter values are optional. +type ServerObjectVariableDefault string +// An optional description for the server variable. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +type ServerObjectVariableDescription string +// An enumeration of string values to be used if the substitution options are from a limited set. +type ServerObjectVariableEnumItem string +// An enumeration of string values to be used if the substitution options are from a limited set. +type ServerObjectVariableEnum []ServerObjectVariableEnumItem +// An object representing a Server Variable for server URL template substitution. +type ServerObjectVariable struct { + Default *ServerObjectVariableDefault `json:"default"` + Description *ServerObjectVariableDescription `json:"description,omitempty"` + Enum *ServerObjectVariableEnum `json:"enum,omitempty"` +} +// A map between a variable name and its value. The value is passed into the [Runtime Expression](#runtime-expression) to produce a server URL. +type ServerObjectVariables map[string]interface{} +// A object representing a Server +type ServerObject struct { + Url *ServerObjectUrl `json:"url"` + Name *ServerObjectName `json:"name,omitempty"` + Description *ServerObjectDescription `json:"description,omitempty"` + Summary *ServerObjectSummary `json:"summary,omitempty"` + Variables *ServerObjectVariables `json:"variables,omitempty"` +} +type AlwaysFalse interface{} +// An array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](#server-object) with a [url](#server-url) value of `localhost`. +type Servers []ServerObject +// The cannonical name for the method. The name MUST be unique within the methods array. +type MethodObjectName string +// A verbose explanation of the method behavior. GitHub Flavored Markdown syntax MAY be used for rich text representation. +type MethodObjectDescription string +// A short summary of what the method does. +type MethodObjectSummary string +// The name of the tag. +type TagObjectName string +// A verbose explanation for the tag. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +type TagObjectDescription string +// Adds metadata to a single tag that is used by the [Method Object](#method-object). It is not mandatory to have a Tag Object per tag defined in the Method Object instances. +type TagObject struct { + Name *TagObjectName `json:"name"` + Description *TagObjectDescription `json:"description,omitempty"` + ExternalDocs *ExternalDocumentationObject `json:"externalDocs,omitempty"` +} +type Ref string +type ReferenceObject struct { + Ref *Ref `json:"$ref"` +} +type TagOrReference struct { + TagObject *TagObject + ReferenceObject *ReferenceObject +} +// UnmarshalJSON implements the json Unmarshaler interface. +// This implementation DOES NOT assert that ONE AND ONLY ONE +// of the simple properties is satisfied; it lazily uses the first one that is satisfied. +// Ergo, it will not return an error if more than one property is valid. +func (o *TagOrReference) UnmarshalJSON(bytes []byte) error { + var myTagObject TagObject + if err := json.Unmarshal(bytes, &myTagObject); err == nil { + o.TagObject = &myTagObject + return nil + } + var myReferenceObject ReferenceObject + if err := json.Unmarshal(bytes, &myReferenceObject); err == nil { + o.ReferenceObject = &myReferenceObject + return nil + } + return errors.New("failed to unmarshal one of the object properties") +} +func (o TagOrReference) MarshalJSON() ([]byte, error) { + if o.TagObject != nil { + return json.Marshal(o.TagObject) + } + if o.ReferenceObject != nil { + return json.Marshal(o.ReferenceObject) + } + return nil, errors.New("failed to marshal any one of the object properties") +} +// A list of tags for API documentation control. Tags can be used for logical grouping of methods by resources or any other qualifier. +type MethodObjectTags []TagOrReference +// Format the server expects the params. Defaults to 'either'. +// +// --- Default --- +// +// either +type MethodObjectParamStructure string +const ( + MethodObjectParamStructureEnum0 MethodObjectParamStructure = "by-position" + MethodObjectParamStructureEnum1 MethodObjectParamStructure = "by-name" + MethodObjectParamStructureEnum2 MethodObjectParamStructure = "either" +) +// Name of the content that is being described. If the content described is a method parameter assignable [`by-name`](#method-param-structure), this field SHALL define the parameter's key (ie name). +type ContentDescriptorObjectName string +// A verbose explanation of the content descriptor behavior. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +type ContentDescriptorObjectDescription string +// A short summary of the content that is being described. +type ContentDescriptorObjectSummary string +type Id string +type Schema string +type Comment string +type Title string +type Description string +type AlwaysTrue interface{} +type ReadOnly bool +type Examples []AlwaysTrue +type MultipleOf float64 +type Maximum float64 +type ExclusiveMaximum float64 +type Minimum float64 +type ExclusiveMinimum float64 +type NonNegativeInteger int64 +type NonNegativeIntegerDefaultZero int64 +type Pattern string +// Always valid if true. Never valid if false. Is constant. +type JSONSchemaBoolean bool +// +// --- Default --- +// +// {} +type JSONSchema struct { + JSONSchemaObject *JSONSchemaObject + JSONSchemaBoolean *JSONSchemaBoolean +} +// UnmarshalJSON implements the json Unmarshaler interface. +// This implementation DOES NOT assert that ONE AND ONLY ONE +// of the simple properties is satisfied; it lazily uses the first one that is satisfied. +// Ergo, it will not return an error if more than one property is valid. +func (o *JSONSchema) UnmarshalJSON(bytes []byte) error { + var myJSONSchemaObject JSONSchemaObject + if err := json.Unmarshal(bytes, &myJSONSchemaObject); err == nil { + o.JSONSchemaObject = &myJSONSchemaObject + return nil + } + var myJSONSchemaBoolean JSONSchemaBoolean + if err := json.Unmarshal(bytes, &myJSONSchemaBoolean); err == nil { + o.JSONSchemaBoolean = &myJSONSchemaBoolean + return nil + } + return errors.New("failed to unmarshal one of the object properties") +} +func (o JSONSchema) MarshalJSON() ([]byte, error) { + if o.JSONSchemaObject != nil { + return json.Marshal(o.JSONSchemaObject) + } + if o.JSONSchemaBoolean != nil { + return json.Marshal(o.JSONSchemaBoolean) + } + return nil, errors.New("failed to marshal any one of the object properties") +} +type SchemaArray []JSONSchema +// +// --- Default --- +// +// true +type Items struct { + JSONSchema *JSONSchema + SchemaArray *SchemaArray +} +func (a *Items) UnmarshalJSON(bytes []byte) error { + var ok bool + var myJSONSchema JSONSchema + if err := json.Unmarshal(bytes, &myJSONSchema); err == nil { + ok = true + a.JSONSchema = &myJSONSchema + } + var mySchemaArray SchemaArray + if err := json.Unmarshal(bytes, &mySchemaArray); err == nil { + ok = true + a.SchemaArray = &mySchemaArray + } + if ok { + return nil + } + return errors.New("failed to unmarshal any of the object properties") +} +func (o Items) MarshalJSON() ([]byte, error) { + out := []interface{}{} + if o.JSONSchema != nil { + out = append(out, o.JSONSchema) + } + if o.SchemaArray != nil { + out = append(out, o.SchemaArray) + } + return json.Marshal(out) +} +type UniqueItems bool +type StringDoaGddGA string +// +// --- Default --- +// +// [] +type StringArray []StringDoaGddGA +// +// --- Default --- +// +// {} +type Definitions map[string]interface{} +// +// --- Default --- +// +// {} +type Properties map[string]interface{} +type PropertyNames interface{} +// +// --- Default --- +// +// {} +type PatternProperties map[string]interface{} +type DependenciesSet struct { + JSONSchema *JSONSchema + StringArray *StringArray +} +func (a *DependenciesSet) UnmarshalJSON(bytes []byte) error { + var ok bool + var myJSONSchema JSONSchema + if err := json.Unmarshal(bytes, &myJSONSchema); err == nil { + ok = true + a.JSONSchema = &myJSONSchema + } + var myStringArray StringArray + if err := json.Unmarshal(bytes, &myStringArray); err == nil { + ok = true + a.StringArray = &myStringArray + } + if ok { + return nil + } + return errors.New("failed to unmarshal any of the object properties") +} +func (o DependenciesSet) MarshalJSON() ([]byte, error) { + out := []interface{}{} + if o.JSONSchema != nil { + out = append(out, o.JSONSchema) + } + if o.StringArray != nil { + out = append(out, o.StringArray) + } + return json.Marshal(out) +} +type Dependencies map[string]interface{} +type Enum []AlwaysTrue +type SimpleTypes string +const ( + SimpleTypesEnum0 SimpleTypes = "array" + SimpleTypesEnum1 SimpleTypes = "boolean" + SimpleTypesEnum2 SimpleTypes = "integer" + SimpleTypesEnum3 SimpleTypes = "null" + SimpleTypesEnum4 SimpleTypes = "number" + SimpleTypesEnum5 SimpleTypes = "object" + SimpleTypesEnum6 SimpleTypes = "string" +) +type ArrayOfSimpleTypes []SimpleTypes +type Type struct { + SimpleTypes *SimpleTypes + ArrayOfSimpleTypes *ArrayOfSimpleTypes +} +func (a *Type) UnmarshalJSON(bytes []byte) error { + var ok bool + var mySimpleTypes SimpleTypes + if err := json.Unmarshal(bytes, &mySimpleTypes); err == nil { + ok = true + a.SimpleTypes = &mySimpleTypes + } + var myArrayOfSimpleTypes ArrayOfSimpleTypes + if err := json.Unmarshal(bytes, &myArrayOfSimpleTypes); err == nil { + ok = true + a.ArrayOfSimpleTypes = &myArrayOfSimpleTypes + } + if ok { + return nil + } + return errors.New("failed to unmarshal any of the object properties") +} +func (o Type) MarshalJSON() ([]byte, error) { + out := []interface{}{} + if o.SimpleTypes != nil { + out = append(out, o.SimpleTypes) + } + if o.ArrayOfSimpleTypes != nil { + out = append(out, o.ArrayOfSimpleTypes) + } + return json.Marshal(out) +} +type Format string +type ContentMediaType string +type ContentEncoding string +type JSONSchemaObject struct { + Id *Id `json:"$id,omitempty"` + Schema *Schema `json:"$schema,omitempty"` + Ref *Ref `json:"$ref,omitempty"` + Comment *Comment `json:"$comment,omitempty"` + Title *Title `json:"title,omitempty"` + Description *Description `json:"description,omitempty"` + Default *AlwaysTrue `json:"default,omitempty"` + ReadOnly *ReadOnly `json:"readOnly,omitempty"` + Examples *Examples `json:"examples,omitempty"` + MultipleOf *MultipleOf `json:"multipleOf,omitempty"` + Maximum *Maximum `json:"maximum,omitempty"` + ExclusiveMaximum *ExclusiveMaximum `json:"exclusiveMaximum,omitempty"` + Minimum *Minimum `json:"minimum,omitempty"` + ExclusiveMinimum *ExclusiveMinimum `json:"exclusiveMinimum,omitempty"` + MaxLength *NonNegativeInteger `json:"maxLength,omitempty"` + MinLength *NonNegativeIntegerDefaultZero `json:"minLength,omitempty"` + Pattern *Pattern `json:"pattern,omitempty"` + AdditionalItems *JSONSchema `json:"additionalItems,omitempty"` + Items *Items `json:"items,omitempty"` + MaxItems *NonNegativeInteger `json:"maxItems,omitempty"` + MinItems *NonNegativeIntegerDefaultZero `json:"minItems,omitempty"` + UniqueItems *UniqueItems `json:"uniqueItems,omitempty"` + Contains *JSONSchema `json:"contains,omitempty"` + MaxProperties *NonNegativeInteger `json:"maxProperties,omitempty"` + MinProperties *NonNegativeIntegerDefaultZero `json:"minProperties,omitempty"` + Required *StringArray `json:"required,omitempty"` + AdditionalProperties *JSONSchema `json:"additionalProperties,omitempty"` + Definitions *Definitions `json:"definitions,omitempty"` + Properties *Properties `json:"properties,omitempty"` + PatternProperties *PatternProperties `json:"patternProperties,omitempty"` + Dependencies *Dependencies `json:"dependencies,omitempty"` + PropertyNames *JSONSchema `json:"propertyNames,omitempty"` + Const *AlwaysTrue `json:"const,omitempty"` + Enum *Enum `json:"enum,omitempty"` + Type *Type `json:"type,omitempty"` + Format *Format `json:"format,omitempty"` + ContentMediaType *ContentMediaType `json:"contentMediaType,omitempty"` + ContentEncoding *ContentEncoding `json:"contentEncoding,omitempty"` + If *JSONSchema `json:"if,omitempty"` + Then *JSONSchema `json:"then,omitempty"` + Else *JSONSchema `json:"else,omitempty"` + AllOf *SchemaArray `json:"allOf,omitempty"` + AnyOf *SchemaArray `json:"anyOf,omitempty"` + OneOf *SchemaArray `json:"oneOf,omitempty"` + Not *JSONSchema `json:"not,omitempty"` +} +// Schema that describes the content. +// +// --- Default --- +// +// {} +type ContentDescriptorObjectSchema struct { + JSONSchemaObject *JSONSchemaObject + JSONSchemaBoolean *JSONSchemaBoolean +} +// UnmarshalJSON implements the json Unmarshaler interface. +// This implementation DOES NOT assert that ONE AND ONLY ONE +// of the simple properties is satisfied; it lazily uses the first one that is satisfied. +// Ergo, it will not return an error if more than one property is valid. +func (o *ContentDescriptorObjectSchema) UnmarshalJSON(bytes []byte) error { + var myJSONSchemaObject JSONSchemaObject + if err := json.Unmarshal(bytes, &myJSONSchemaObject); err == nil { + o.JSONSchemaObject = &myJSONSchemaObject + return nil + } + var myJSONSchemaBoolean JSONSchemaBoolean + if err := json.Unmarshal(bytes, &myJSONSchemaBoolean); err == nil { + o.JSONSchemaBoolean = &myJSONSchemaBoolean + return nil + } + return errors.New("failed to unmarshal one of the object properties") +} +func (o ContentDescriptorObjectSchema) MarshalJSON() ([]byte, error) { + if o.JSONSchemaObject != nil { + return json.Marshal(o.JSONSchemaObject) + } + if o.JSONSchemaBoolean != nil { + return json.Marshal(o.JSONSchemaBoolean) + } + return nil, errors.New("failed to marshal any one of the object properties") +} +// Determines if the content is a required field. Default value is `false`. +type ContentDescriptorObjectRequired bool +// Specifies that the content is deprecated and SHOULD be transitioned out of usage. Default value is `false`. +type ContentDescriptorObjectDeprecated bool +// Content Descriptors are objects that do just as they suggest - describe content. They are reusable ways of describing either parameters or result. They MUST have a schema. +type ContentDescriptorObject struct { + Name *ContentDescriptorObjectName `json:"name"` + Description *ContentDescriptorObjectDescription `json:"description,omitempty"` + Summary *ContentDescriptorObjectSummary `json:"summary,omitempty"` + Schema *ContentDescriptorObjectSchema `json:"schema"` + Required *ContentDescriptorObjectRequired `json:"required,omitempty"` + Deprecated *ContentDescriptorObjectDeprecated `json:"deprecated,omitempty"` +} +type ContentDescriptorOrReference struct { + ContentDescriptorObject *ContentDescriptorObject + ReferenceObject *ReferenceObject +} +// UnmarshalJSON implements the json Unmarshaler interface. +// This implementation DOES NOT assert that ONE AND ONLY ONE +// of the simple properties is satisfied; it lazily uses the first one that is satisfied. +// Ergo, it will not return an error if more than one property is valid. +func (o *ContentDescriptorOrReference) UnmarshalJSON(bytes []byte) error { + var myContentDescriptorObject ContentDescriptorObject + if err := json.Unmarshal(bytes, &myContentDescriptorObject); err == nil { + o.ContentDescriptorObject = &myContentDescriptorObject + return nil + } + var myReferenceObject ReferenceObject + if err := json.Unmarshal(bytes, &myReferenceObject); err == nil { + o.ReferenceObject = &myReferenceObject + return nil + } + return errors.New("failed to unmarshal one of the object properties") +} +func (o ContentDescriptorOrReference) MarshalJSON() ([]byte, error) { + if o.ContentDescriptorObject != nil { + return json.Marshal(o.ContentDescriptorObject) + } + if o.ReferenceObject != nil { + return json.Marshal(o.ReferenceObject) + } + return nil, errors.New("failed to marshal any one of the object properties") +} +// A list of parameters that are applicable for this method. The list MUST NOT include duplicated parameters and therefore require [name](#content-descriptor-name) to be unique. The list can use the [Reference Object](#reference-object) to link to parameters that are defined by the [Content Descriptor Object](#content-descriptor-object). All optional params (content descriptor objects with "required": false) MUST be positioned after all required params in the list. +type MethodObjectParams []ContentDescriptorOrReference +// The description of the result returned by the method. If defined, it MUST be a Content Descriptor or Reference Object. If undefined, the method MUST only be used as a [notification](https://www.jsonrpc.org/specification#notification) +type MethodObjectResult struct { + ContentDescriptorObject *ContentDescriptorObject + ReferenceObject *ReferenceObject +} +// UnmarshalJSON implements the json Unmarshaler interface. +// This implementation DOES NOT assert that ONE AND ONLY ONE +// of the simple properties is satisfied; it lazily uses the first one that is satisfied. +// Ergo, it will not return an error if more than one property is valid. +func (o *MethodObjectResult) UnmarshalJSON(bytes []byte) error { + var myContentDescriptorObject ContentDescriptorObject + if err := json.Unmarshal(bytes, &myContentDescriptorObject); err == nil { + o.ContentDescriptorObject = &myContentDescriptorObject + return nil + } + var myReferenceObject ReferenceObject + if err := json.Unmarshal(bytes, &myReferenceObject); err == nil { + o.ReferenceObject = &myReferenceObject + return nil + } + return errors.New("failed to unmarshal one of the object properties") +} +func (o MethodObjectResult) MarshalJSON() ([]byte, error) { + if o.ContentDescriptorObject != nil { + return json.Marshal(o.ContentDescriptorObject) + } + if o.ReferenceObject != nil { + return json.Marshal(o.ReferenceObject) + } + return nil, errors.New("failed to marshal any one of the object properties") +} +// A Number that indicates the error type that occurred. This MUST be an integer. The error codes from and including -32768 to -32000 are reserved for pre-defined errors. These pre-defined errors SHOULD be assumed to be returned from any JSON-RPC api. +type ErrorObjectCode int64 +// A String providing a short description of the error. The message SHOULD be limited to a concise single sentence. +type ErrorObjectMessage string +// A Primitive or Structured value that contains additional information about the error. This may be omitted. The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.). +type ErrorObjectData interface{} +// Defines an application level error. +type ErrorObject struct { + Code *ErrorObjectCode `json:"code"` + Message *ErrorObjectMessage `json:"message"` + Data *ErrorObjectData `json:"data,omitempty"` +} +type ErrorOrReference struct { + ErrorObject *ErrorObject + ReferenceObject *ReferenceObject +} +// UnmarshalJSON implements the json Unmarshaler interface. +// This implementation DOES NOT assert that ONE AND ONLY ONE +// of the simple properties is satisfied; it lazily uses the first one that is satisfied. +// Ergo, it will not return an error if more than one property is valid. +func (o *ErrorOrReference) UnmarshalJSON(bytes []byte) error { + var myErrorObject ErrorObject + if err := json.Unmarshal(bytes, &myErrorObject); err == nil { + o.ErrorObject = &myErrorObject + return nil + } + var myReferenceObject ReferenceObject + if err := json.Unmarshal(bytes, &myReferenceObject); err == nil { + o.ReferenceObject = &myReferenceObject + return nil + } + return errors.New("failed to unmarshal one of the object properties") +} +func (o ErrorOrReference) MarshalJSON() ([]byte, error) { + if o.ErrorObject != nil { + return json.Marshal(o.ErrorObject) + } + if o.ReferenceObject != nil { + return json.Marshal(o.ReferenceObject) + } + return nil, errors.New("failed to marshal any one of the object properties") +} +// A list of custom application defined errors that MAY be returned. The Errors MUST have unique error codes. +type MethodObjectErrors []ErrorOrReference +// Cannonical name of the link. +type LinkObjectName interface{} +// Short description for the link. +type LinkObjectSummary string +// The name of an existing, resolvable OpenRPC method, as defined with a unique `method`. This field MUST resolve to a unique [Method Object](#method-object). As opposed to Open Api, Relative `method` values ARE NOT permitted. +type LinkObjectMethod string +// A description of the link. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +type LinkObjectDescription string +// A map representing parameters to pass to a method as specified with `method`. The key is the parameter name to be used, whereas the value can be a constant or a [runtime expression](#runtime-expression) to be evaluated and passed to the linked method. +type LinkObjectParams interface{} +// A server object to be used by the target method. +type LinkObjectServer struct { + Url *ServerObjectUrl `json:"url"` + Name *ServerObjectName `json:"name,omitempty"` + Description *ServerObjectDescription `json:"description,omitempty"` + Summary *ServerObjectSummary `json:"summary,omitempty"` + Variables *ServerObjectVariables `json:"variables,omitempty"` +} +// A object representing a Link +type LinkObject interface{} +type LinkOrReference struct { + LinkObject *LinkObject + ReferenceObject *ReferenceObject +} +// UnmarshalJSON implements the json Unmarshaler interface. +// This implementation DOES NOT assert that ONE AND ONLY ONE +// of the simple properties is satisfied; it lazily uses the first one that is satisfied. +// Ergo, it will not return an error if more than one property is valid. +func (o *LinkOrReference) UnmarshalJSON(bytes []byte) error { + var myLinkObject LinkObject + if err := json.Unmarshal(bytes, &myLinkObject); err == nil { + o.LinkObject = &myLinkObject + return nil + } + var myReferenceObject ReferenceObject + if err := json.Unmarshal(bytes, &myReferenceObject); err == nil { + o.ReferenceObject = &myReferenceObject + return nil + } + return errors.New("failed to unmarshal one of the object properties") +} +func (o LinkOrReference) MarshalJSON() ([]byte, error) { + if o.LinkObject != nil { + return json.Marshal(o.LinkObject) + } + if o.ReferenceObject != nil { + return json.Marshal(o.ReferenceObject) + } + return nil, errors.New("failed to marshal any one of the object properties") +} +// A list of possible links from this method call. +type MethodObjectLinks []LinkOrReference +// Name for the example pairing. +type ExamplePairingObjectName string +// A verbose explanation of the example pairing. +type ExamplePairingObjectDescription string +// Short description for the example. +type ExampleObjectSummary string +// Embedded literal example. The `value` field and `externalValue` field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON, use a string value to contain the example, escaping where necessary. +type ExampleObjectValue interface{} +// A verbose explanation of the example. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +type ExampleObjectDescription string +// Cannonical name of the example. +type ExampleObjectName string +// The Example object is an object that defines an example that is intended to match the `schema` of a given [Content Descriptor](#content-descriptor-object). +type ExampleObject struct { + Summary *ExampleObjectSummary `json:"summary,omitempty"` + Value *ExampleObjectValue `json:"value"` + Description *ExampleObjectDescription `json:"description,omitempty"` + Name *ExampleObjectName `json:"name"` +} +type ExampleOrReference struct { + ExampleObject *ExampleObject + ReferenceObject *ReferenceObject +} +// UnmarshalJSON implements the json Unmarshaler interface. +// This implementation DOES NOT assert that ONE AND ONLY ONE +// of the simple properties is satisfied; it lazily uses the first one that is satisfied. +// Ergo, it will not return an error if more than one property is valid. +func (o *ExampleOrReference) UnmarshalJSON(bytes []byte) error { + var myExampleObject ExampleObject + if err := json.Unmarshal(bytes, &myExampleObject); err == nil { + o.ExampleObject = &myExampleObject + return nil + } + var myReferenceObject ReferenceObject + if err := json.Unmarshal(bytes, &myReferenceObject); err == nil { + o.ReferenceObject = &myReferenceObject + return nil + } + return errors.New("failed to unmarshal one of the object properties") +} +func (o ExampleOrReference) MarshalJSON() ([]byte, error) { + if o.ExampleObject != nil { + return json.Marshal(o.ExampleObject) + } + if o.ReferenceObject != nil { + return json.Marshal(o.ReferenceObject) + } + return nil, errors.New("failed to marshal any one of the object properties") +} +// Example parameters. +type ExamplePairingObjectParams []ExampleOrReference +// Example result. When not provided, the example pairing represents usage of the method as a notification. +type ExamplePairingObjectResult struct { + ExampleObject *ExampleObject + ReferenceObject *ReferenceObject +} +// UnmarshalJSON implements the json Unmarshaler interface. +// This implementation DOES NOT assert that ONE AND ONLY ONE +// of the simple properties is satisfied; it lazily uses the first one that is satisfied. +// Ergo, it will not return an error if more than one property is valid. +func (o *ExamplePairingObjectResult) UnmarshalJSON(bytes []byte) error { + var myExampleObject ExampleObject + if err := json.Unmarshal(bytes, &myExampleObject); err == nil { + o.ExampleObject = &myExampleObject + return nil + } + var myReferenceObject ReferenceObject + if err := json.Unmarshal(bytes, &myReferenceObject); err == nil { + o.ReferenceObject = &myReferenceObject + return nil + } + return errors.New("failed to unmarshal one of the object properties") +} +func (o ExamplePairingObjectResult) MarshalJSON() ([]byte, error) { + if o.ExampleObject != nil { + return json.Marshal(o.ExampleObject) + } + if o.ReferenceObject != nil { + return json.Marshal(o.ReferenceObject) + } + return nil, errors.New("failed to marshal any one of the object properties") +} +// The Example Pairing object consists of a set of example params and result. The result is what you can expect from the JSON-RPC service given the exact params. +type ExamplePairingObject struct { + Name *ExamplePairingObjectName `json:"name"` + Description *ExamplePairingObjectDescription `json:"description,omitempty"` + Params *ExamplePairingObjectParams `json:"params"` + Result *ExamplePairingObjectResult `json:"result,omitempty"` +} +type ExamplePairingOrReference struct { + ExamplePairingObject *ExamplePairingObject + ReferenceObject *ReferenceObject +} +// UnmarshalJSON implements the json Unmarshaler interface. +// This implementation DOES NOT assert that ONE AND ONLY ONE +// of the simple properties is satisfied; it lazily uses the first one that is satisfied. +// Ergo, it will not return an error if more than one property is valid. +func (o *ExamplePairingOrReference) UnmarshalJSON(bytes []byte) error { + var myExamplePairingObject ExamplePairingObject + if err := json.Unmarshal(bytes, &myExamplePairingObject); err == nil { + o.ExamplePairingObject = &myExamplePairingObject + return nil + } + var myReferenceObject ReferenceObject + if err := json.Unmarshal(bytes, &myReferenceObject); err == nil { + o.ReferenceObject = &myReferenceObject + return nil + } + return errors.New("failed to unmarshal one of the object properties") +} +func (o ExamplePairingOrReference) MarshalJSON() ([]byte, error) { + if o.ExamplePairingObject != nil { + return json.Marshal(o.ExamplePairingObject) + } + if o.ReferenceObject != nil { + return json.Marshal(o.ReferenceObject) + } + return nil, errors.New("failed to marshal any one of the object properties") +} +// Array of [Example Pairing Objects](#example-pairing-object) where each example includes a valid params-to-result [Content Descriptor](#content-descriptor-object) pairing. +type MethodObjectExamples []ExamplePairingOrReference +// Declares this method to be deprecated. Consumers SHOULD refrain from usage of the declared method. Default value is `false`. +type MethodObjectDeprecated bool +// Describes the interface for the given method name. The method name is used as the `method` field of the JSON-RPC body. It therefore MUST be unique. +type MethodObject struct { + Name *MethodObjectName `json:"name"` + Description *MethodObjectDescription `json:"description,omitempty"` + Summary *MethodObjectSummary `json:"summary,omitempty"` + Servers *Servers `json:"servers,omitempty"` + Tags *MethodObjectTags `json:"tags,omitempty"` + ParamStructure *MethodObjectParamStructure `json:"paramStructure,omitempty"` + Params *MethodObjectParams `json:"params"` + Result *MethodObjectResult `json:"result,omitempty"` + Errors *MethodObjectErrors `json:"errors,omitempty"` + Links *MethodObjectLinks `json:"links,omitempty"` + Examples *MethodObjectExamples `json:"examples,omitempty"` + Deprecated *MethodObjectDeprecated `json:"deprecated,omitempty"` + ExternalDocs *ExternalDocumentationObject `json:"externalDocs,omitempty"` +} +type MethodOrReference struct { + MethodObject *MethodObject + ReferenceObject *ReferenceObject +} +// UnmarshalJSON implements the json Unmarshaler interface. +// This implementation DOES NOT assert that ONE AND ONLY ONE +// of the simple properties is satisfied; it lazily uses the first one that is satisfied. +// Ergo, it will not return an error if more than one property is valid. +func (o *MethodOrReference) UnmarshalJSON(bytes []byte) error { + var myMethodObject MethodObject + if err := json.Unmarshal(bytes, &myMethodObject); err == nil { + o.MethodObject = &myMethodObject + return nil + } + var myReferenceObject ReferenceObject + if err := json.Unmarshal(bytes, &myReferenceObject); err == nil { + o.ReferenceObject = &myReferenceObject + return nil + } + return errors.New("failed to unmarshal one of the object properties") +} +func (o MethodOrReference) MarshalJSON() ([]byte, error) { + if o.MethodObject != nil { + return json.Marshal(o.MethodObject) + } + if o.ReferenceObject != nil { + return json.Marshal(o.ReferenceObject) + } + return nil, errors.New("failed to marshal any one of the object properties") +} +// The available methods for the API. While it is required, the array may be empty (to handle security filtering, for example). +type Methods []MethodOrReference +// An object to hold reusable [Schema Objects](#schema-object). +type SchemaComponents map[string]interface{} +// An object to hold reusable [Link Objects](#link-object). +type LinkComponents map[string]interface{} +// An object to hold reusable [Error Objects](#error-object). +type ErrorComponents map[string]interface{} +// An object to hold reusable [Example Objects](#example-object). +type ExampleComponents map[string]interface{} +// An object to hold reusable [Example Pairing Objects](#example-pairing-object). +type ExamplePairingComponents map[string]interface{} +// An object to hold reusable [Content Descriptor Objects](#content-descriptor-object). +type ContentDescriptorComponents map[string]interface{} +// An object to hold reusable [Tag Objects](#tag-object). +type TagComponents map[string]interface{} +// Holds a set of reusable objects for different aspects of the OpenRPC. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object. +type Components struct { + Schemas *SchemaComponents `json:"schemas,omitempty"` + Links *LinkComponents `json:"links,omitempty"` + Errors *ErrorComponents `json:"errors,omitempty"` + Examples *ExampleComponents `json:"examples,omitempty"` + ExamplePairings *ExamplePairingComponents `json:"examplePairings,omitempty"` + ContentDescriptors *ContentDescriptorComponents `json:"contentDescriptors,omitempty"` + Tags *TagComponents `json:"tags,omitempty"` +} +// JSON Schema URI (used by some editors) +// +// --- Default --- +// +// https://meta.open-rpc.org/ +type MetaSchema string +type OpenrpcDocument struct { + Openrpc *Openrpc `json:"openrpc"` + Info *InfoObject `json:"info"` + ExternalDocs *ExternalDocumentationObject `json:"externalDocs,omitempty"` + Servers *Servers `json:"servers,omitempty"` + Methods *Methods `json:"methods"` + Components *Components `json:"components,omitempty"` + Schema *MetaSchema `json:"$schema,omitempty"` +} + +const RawOpenrpcDocument = "{\"$schema\":\"https://meta.json-schema.tools/\",\"$id\":\"https://meta.open-rpc.org/\",\"title\":\"openrpcDocument\",\"type\":\"object\",\"required\":[\"info\",\"methods\",\"openrpc\"],\"additionalProperties\":false,\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"openrpc\":{\"description\":\"This string MUST be the [semantic version number](https://semver.org/spec/v2.0.0.html) of the [OpenRPC Specification version](#versions) that the OpenRPC document uses. The `openrpc` field SHOULD be used by tooling specifications and clients to interpret the OpenRPC document. This is *not* related to the API [`info.version`](#info-version) string.\",\"title\":\"openrpc\",\"type\":\"string\",\"regex\":\"^1\\\\.4\\\\.\\\\d+$\"},\"info\":{\"$ref\":\"#/definitions/infoObject\"},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocumentationObject\"},\"servers\":{\"description\":\"An array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](#server-object) with a [url](#server-url) value of `localhost`. \",\"title\":\"servers\",\"type\":\"array\",\"additionalItems\":false,\"items\":{\"$ref\":\"#/definitions/serverObject\"}},\"methods\":{\"title\":\"methods\",\"type\":\"array\",\"description\":\"The available methods for the API. While it is required, the array may be empty (to handle security filtering, for example).\",\"additionalItems\":false,\"items\":{\"title\":\"methodOrReference\",\"oneOf\":[{\"$ref\":\"#/definitions/methodObject\"},{\"$ref\":\"#/definitions/referenceObject\"}]}},\"components\":{\"title\":\"components\",\"description\":\"Holds a set of reusable objects for different aspects of the OpenRPC. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.\",\"type\":\"object\",\"properties\":{\"schemas\":{\"title\":\"schemaComponents\",\"description\":\"An object to hold reusable [Schema Objects](#schema-object).\",\"type\":\"object\",\"patternProperties\":{\"[0-z]+\":{\"$ref\":\"#/definitions/JSONSchema\"}}},\"links\":{\"title\":\"linkComponents\",\"type\":\"object\",\"description\":\"An object to hold reusable [Link Objects](#link-object).\",\"patternProperties\":{\"[0-z]+\":{\"$ref\":\"#/definitions/linkObject\"}}},\"errors\":{\"title\":\"errorComponents\",\"description\":\"An object to hold reusable [Error Objects](#error-object).\",\"type\":\"object\",\"patternProperties\":{\"[0-z]+\":{\"$ref\":\"#/definitions/errorObject\"}}},\"examples\":{\"title\":\"exampleComponents\",\"description\":\"An object to hold reusable [Example Objects](#example-object).\",\"type\":\"object\",\"patternProperties\":{\"[0-z]+\":{\"$ref\":\"#/definitions/exampleObject\"}}},\"examplePairings\":{\"title\":\"examplePairingComponents\",\"description\":\"An object to hold reusable [Example Pairing Objects](#example-pairing-object).\",\"type\":\"object\",\"patternProperties\":{\"[0-z]+\":{\"$ref\":\"#/definitions/examplePairingObject\"}}},\"contentDescriptors\":{\"title\":\"contentDescriptorComponents\",\"description\":\"An object to hold reusable [Content Descriptor Objects](#content-descriptor-object).\",\"type\":\"object\",\"patternProperties\":{\"[0-z]+\":{\"$ref\":\"#/definitions/contentDescriptorObject\"}}},\"tags\":{\"title\":\"tagComponents\",\"description\":\"An object to hold reusable [Tag Objects](#tag-object).\",\"type\":\"object\",\"patternProperties\":{\"[0-z]+\":{\"$ref\":\"#/definitions/tagObject\"}}}}},\"$schema\":{\"title\":\"metaSchema\",\"description\":\"JSON Schema URI (used by some editors)\",\"type\":\"string\",\"default\":\"https://meta.open-rpc.org/\"}},\"definitions\":{\"specificationExtension\":{\"title\":\"specificationExtension\",\"description\":\"This object MAY be extended with [Specification Extensions](#specification-extensions).\"},\"JSONSchema\":{\"$ref\":\"https://meta.json-schema.tools\"},\"referenceObject\":{\"title\":\"referenceObject\",\"type\":\"object\",\"additionalProperties\":false,\"required\":[\"$ref\"],\"properties\":{\"$ref\":{\"description\":\"The reference string.\",\"$ref\":\"https://meta.json-schema.tools/#/definitions/JSONSchemaObject/properties/$ref\"}}},\"errorObject\":{\"title\":\"errorObject\",\"type\":\"object\",\"description\":\"Defines an application level error.\",\"additionalProperties\":false,\"required\":[\"code\",\"message\"],\"properties\":{\"code\":{\"title\":\"errorObjectCode\",\"description\":\"A Number that indicates the error type that occurred. This MUST be an integer. The error codes from and including -32768 to -32000 are reserved for pre-defined errors. These pre-defined errors SHOULD be assumed to be returned from any JSON-RPC api.\",\"type\":\"integer\"},\"message\":{\"title\":\"errorObjectMessage\",\"description\":\"A String providing a short description of the error. The message SHOULD be limited to a concise single sentence.\",\"type\":\"string\"},\"data\":{\"title\":\"errorObjectData\",\"description\":\"A Primitive or Structured value that contains additional information about the error. This may be omitted. The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.).\"}}},\"licenseObject\":{\"title\":\"licenseObject\",\"description\":\"License information for the exposed API.\",\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"name\":{\"title\":\"licenseObjectName\",\"description\":\"The license name used for the API.\",\"type\":\"string\"},\"url\":{\"title\":\"licenseObjectUrl\",\"description\":\"A URL to the license used for the API. MUST be in the format of a URL.\",\"type\":\"string\"}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"contactObject\":{\"description\":\"Contact information for the exposed API.\",\"title\":\"contactObject\",\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"name\":{\"title\":\"contactObjectName\",\"description\":\"The identifying name of the contact person/organization.\",\"type\":\"string\"},\"email\":{\"title\":\"contactObjectEmail\",\"description\":\"The email address of the contact person/organization. MUST be in the format of an email address.\",\"type\":\"string\"},\"url\":{\"title\":\"contactObjectUrl\",\"description\":\"The URL pointing to the contact information. MUST be in the format of a URL.\",\"type\":\"string\"}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"infoObject\":{\"title\":\"infoObject\",\"description\":\"The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.\",\"additionalProperties\":false,\"required\":[\"title\",\"version\"],\"properties\":{\"title\":{\"title\":\"infoObjectTitle\",\"description\":\"The title of the application.\",\"type\":\"string\"},\"description\":{\"title\":\"infoObjectDescription\",\"description\":\"A verbose description of the application. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation.\",\"type\":\"string\"},\"termsOfService\":{\"title\":\"infoObjectTermsOfService\",\"description\":\"A URL to the Terms of Service for the API. MUST be in the format of a URL.\",\"type\":\"string\",\"format\":\"uri\"},\"version\":{\"title\":\"infoObjectVersion\",\"description\":\"The version of the OpenRPC document (which is distinct from the [OpenRPC Specification version](#openrpc-document-openrpc) or the API implementation version).\",\"type\":\"string\"},\"contact\":{\"$ref\":\"#/definitions/contactObject\"},\"license\":{\"$ref\":\"#/definitions/licenseObject\"}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"serverObject\":{\"title\":\"serverObject\",\"description\":\"A object representing a Server\",\"type\":\"object\",\"required\":[\"url\"],\"additionalProperties\":false,\"properties\":{\"url\":{\"title\":\"serverObjectUrl\",\"description\":\"A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenRPC document is being served. [Server Variables](#server-variables) are passed into the [Runtime Expression](#runtime-expression) to produce a server URL.\",\"type\":\"string\",\"format\":\"uri\"},\"name\":{\"title\":\"serverObjectName\",\"description\":\"An optional string describing the name of the server. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation.\",\"type\":\"string\"},\"description\":{\"title\":\"serverObjectDescription\",\"description\":\"An optional string describing the host designated by the URL. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation.\",\"type\":\"string\"},\"summary\":{\"title\":\"serverObjectSummary\",\"description\":\"A short summary of what the server is.\",\"type\":\"string\"},\"variables\":{\"title\":\"serverObjectVariables\",\"description\":\"A map between a variable name and its value. The value is passed into the [Runtime Expression](#runtime-expression) to produce a server URL.\",\"type\":\"object\",\"patternProperties\":{\"[0-z]+\":{\"title\":\"serverObjectVariable\",\"description\":\"An object representing a Server Variable for server URL template substitution.\",\"type\":\"object\",\"required\":[\"default\"],\"properties\":{\"default\":{\"title\":\"serverObjectVariableDefault\",\"description\":\"The default value to use for substitution, which SHALL be sent if an alternate value is _not_ supplied. Note this behavior is different than the [Schema Object's](#schema-object) treatment of default values, because in those cases parameter values are optional.\",\"type\":\"string\"},\"description\":{\"title\":\"serverObjectVariableDescription\",\"description\":\"An optional description for the server variable. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation.\",\"type\":\"string\"},\"enum\":{\"title\":\"serverObjectVariableEnum\",\"description\":\"An enumeration of string values to be used if the substitution options are from a limited set.\",\"type\":\"array\",\"items\":{\"title\":\"serverObjectVariableEnumItem\",\"description\":\"An enumeration of string values to be used if the substitution options are from a limited set.\",\"type\":\"string\"}}}}}}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"linkObject\":{\"title\":\"linkObject\",\"description\":\"A object representing a Link\",\"additionalProperties\":false,\"properties\":{\"name\":{\"title\":\"linkObjectName\",\"description\":\"Cannonical name of the link.\",\"minLength\":1},\"summary\":{\"title\":\"linkObjectSummary\",\"description\":\"Short description for the link.\",\"type\":\"string\"},\"method\":{\"title\":\"linkObjectMethod\",\"description\":\"The name of an existing, resolvable OpenRPC method, as defined with a unique `method`. This field MUST resolve to a unique [Method Object](#method-object). As opposed to Open Api, Relative `method` values ARE NOT permitted.\",\"type\":\"string\"},\"description\":{\"title\":\"linkObjectDescription\",\"description\":\"A description of the link. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation.\",\"type\":\"string\"},\"params\":{\"title\":\"linkObjectParams\",\"description\":\"A map representing parameters to pass to a method as specified with `method`. The key is the parameter name to be used, whereas the value can be a constant or a [runtime expression](#runtime-expression) to be evaluated and passed to the linked method.\"},\"server\":{\"title\":\"linkObjectServer\",\"description\":\"A server object to be used by the target method.\",\"$ref\":\"#/definitions/serverObject\"}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"externalDocumentationObject\":{\"description\":\"Additional external documentation.\",\"title\":\"externalDocumentationObject\",\"type\":\"object\",\"additionalProperties\":false,\"required\":[\"url\"],\"properties\":{\"description\":{\"description\":\"A verbose explanation of the documentation. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation.\",\"title\":\"externalDocumentationObjectDescription\",\"type\":\"string\"},\"url\":{\"description\":\"The URL for the target documentation. Value MUST be in the format of a URL.\",\"title\":\"externalDocumentationObjectUrl\",\"type\":\"string\",\"format\":\"uri\"}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"methodObject\":{\"title\":\"methodObject\",\"description\":\"Describes the interface for the given method name. The method name is used as the `method` field of the JSON-RPC body. It therefore MUST be unique.\",\"type\":\"object\",\"required\":[\"name\",\"params\"],\"additionalProperties\":false,\"properties\":{\"name\":{\"title\":\"methodObjectName\",\"description\":\"The cannonical name for the method. The name MUST be unique within the methods array.\",\"type\":\"string\",\"minLength\":1},\"description\":{\"title\":\"methodObjectDescription\",\"description\":\"A verbose explanation of the method behavior. GitHub Flavored Markdown syntax MAY be used for rich text representation.\",\"type\":\"string\"},\"summary\":{\"title\":\"methodObjectSummary\",\"description\":\"A short summary of what the method does.\",\"type\":\"string\"},\"servers\":{\"title\":\"servers\",\"type\":\"array\",\"description\":\"An array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](#server-object) with a [url](#server-url) value of `localhost`. \",\"additionalItems\":false,\"items\":{\"$ref\":\"#/definitions/serverObject\"}},\"tags\":{\"title\":\"methodObjectTags\",\"description\":\"A list of tags for API documentation control. Tags can be used for logical grouping of methods by resources or any other qualifier.\",\"type\":\"array\",\"items\":{\"title\":\"tagOrReference\",\"oneOf\":[{\"$ref\":\"#/definitions/tagObject\"},{\"$ref\":\"#/definitions/referenceObject\"}]}},\"paramStructure\":{\"title\":\"methodObjectParamStructure\",\"type\":\"string\",\"description\":\"Format the server expects the params. Defaults to 'either'.\",\"enum\":[\"by-position\",\"by-name\",\"either\"],\"default\":\"either\"},\"params\":{\"title\":\"methodObjectParams\",\"description\":\" A list of parameters that are applicable for this method. The list MUST NOT include duplicated parameters and therefore require [name](#content-descriptor-name) to be unique. The list can use the [Reference Object](#reference-object) to link to parameters that are defined by the [Content Descriptor Object](#content-descriptor-object). All optional params (content descriptor objects with \\\"required\\\": false) MUST be positioned after all required params in the list.\",\"type\":\"array\",\"items\":{\"title\":\"contentDescriptorOrReference\",\"oneOf\":[{\"$ref\":\"#/definitions/contentDescriptorObject\"},{\"$ref\":\"#/definitions/referenceObject\"}]}},\"result\":{\"title\":\"methodObjectResult\",\"description\":\"The description of the result returned by the method. If defined, it MUST be a Content Descriptor or Reference Object. If undefined, the method MUST only be used as a [notification](https://www.jsonrpc.org/specification#notification)\",\"oneOf\":[{\"$ref\":\"#/definitions/contentDescriptorObject\"},{\"$ref\":\"#/definitions/referenceObject\"}]},\"errors\":{\"title\":\"methodObjectErrors\",\"description\":\"A list of custom application defined errors that MAY be returned. The Errors MUST have unique error codes.\",\"type\":\"array\",\"items\":{\"title\":\"errorOrReference\",\"oneOf\":[{\"$ref\":\"#/definitions/errorObject\"},{\"$ref\":\"#/definitions/referenceObject\"}]}},\"links\":{\"title\":\"methodObjectLinks\",\"description\":\"A list of possible links from this method call.\",\"type\":\"array\",\"items\":{\"title\":\"linkOrReference\",\"oneOf\":[{\"$ref\":\"#/definitions/linkObject\"},{\"$ref\":\"#/definitions/referenceObject\"}]}},\"examples\":{\"title\":\"methodObjectExamples\",\"description\":\"Array of [Example Pairing Objects](#example-pairing-object) where each example includes a valid params-to-result [Content Descriptor](#content-descriptor-object) pairing.\",\"type\":\"array\",\"items\":{\"title\":\"examplePairingOrReference\",\"oneOf\":[{\"$ref\":\"#/definitions/examplePairingObject\"},{\"$ref\":\"#/definitions/referenceObject\"}]}},\"deprecated\":{\"title\":\"methodObjectDeprecated\",\"description\":\"Declares this method to be deprecated. Consumers SHOULD refrain from usage of the declared method. Default value is `false`.\",\"type\":\"boolean\",\"default\":false},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocumentationObject\"}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"tagObject\":{\"title\":\"tagObject\",\"description\":\"Adds metadata to a single tag that is used by the [Method Object](#method-object). It is not mandatory to have a Tag Object per tag defined in the Method Object instances.\",\"type\":\"object\",\"additionalProperties\":false,\"required\":[\"name\"],\"properties\":{\"name\":{\"title\":\"tagObjectName\",\"description\":\"The name of the tag.\",\"type\":\"string\",\"minLength\":1},\"description\":{\"title\":\"tagObjectDescription\",\"description\":\"A verbose explanation for the tag. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation.\",\"type\":\"string\"},\"externalDocs\":{\"description\":\"Additional external documentation for this tag.\",\"$ref\":\"#/definitions/externalDocumentationObject\"}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"exampleObject\":{\"title\":\"exampleObject\",\"description\":\"The Example object is an object that defines an example that is intended to match the `schema` of a given [Content Descriptor](#content-descriptor-object).\",\"type\":\"object\",\"required\":[\"name\",\"value\"],\"properties\":{\"summary\":{\"title\":\"exampleObjectSummary\",\"description\":\"Short description for the example.\",\"type\":\"string\"},\"value\":{\"title\":\"exampleObjectValue\",\"description\":\"Embedded literal example. The `value` field and `externalValue` field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON, use a string value to contain the example, escaping where necessary.\"},\"description\":{\"title\":\"exampleObjectDescription\",\"description\":\"A verbose explanation of the example. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation.\",\"type\":\"string\"},\"name\":{\"title\":\"exampleObjectName\",\"description\":\"Cannonical name of the example.\",\"type\":\"string\",\"minLength\":1}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"examplePairingObject\":{\"title\":\"examplePairingObject\",\"description\":\"The Example Pairing object consists of a set of example params and result. The result is what you can expect from the JSON-RPC service given the exact params.\",\"type\":\"object\",\"required\":[\"name\",\"params\"],\"properties\":{\"name\":{\"title\":\"examplePairingObjectName\",\"description\":\"Name for the example pairing.\",\"type\":\"string\",\"minLength\":1},\"description\":{\"title\":\"examplePairingObjectDescription\",\"description\":\"A verbose explanation of the example pairing.\",\"type\":\"string\"},\"params\":{\"title\":\"examplePairingObjectParams\",\"description\":\"Example parameters.\",\"type\":\"array\",\"items\":{\"title\":\"exampleOrReference\",\"oneOf\":[{\"$ref\":\"#/definitions/exampleObject\"},{\"$ref\":\"#/definitions/referenceObject\"}]}},\"result\":{\"title\":\"examplePairingObjectResult\",\"description\":\"Example result. When not provided, the example pairing represents usage of the method as a notification.\",\"oneOf\":[{\"$ref\":\"#/definitions/exampleObject\"},{\"$ref\":\"#/definitions/referenceObject\"}]}}},\"contentDescriptorObject\":{\"title\":\"contentDescriptorObject\",\"description\":\"Content Descriptors are objects that do just as they suggest - describe content. They are reusable ways of describing either parameters or result. They MUST have a schema.\",\"type\":\"object\",\"additionalProperties\":false,\"required\":[\"name\",\"schema\"],\"properties\":{\"name\":{\"title\":\"contentDescriptorObjectName\",\"description\":\"Name of the content that is being described. If the content described is a method parameter assignable [`by-name`](#method-param-structure), this field SHALL define the parameter's key (ie name).\",\"type\":\"string\",\"minLength\":1},\"description\":{\"title\":\"contentDescriptorObjectDescription\",\"description\":\"A verbose explanation of the content descriptor behavior. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation.\",\"type\":\"string\"},\"summary\":{\"title\":\"contentDescriptorObjectSummary\",\"description\":\"A short summary of the content that is being described.\",\"type\":\"string\"},\"schema\":{\"title\":\"contentDescriptorObjectSchema\",\"description\":\"Schema that describes the content.\",\"$ref\":\"#/definitions/JSONSchema\"},\"required\":{\"title\":\"contentDescriptorObjectRequired\",\"description\":\"Determines if the content is a required field. Default value is `false`.\",\"type\":\"boolean\",\"default\":false},\"deprecated\":{\"title\":\"contentDescriptorObjectDeprecated\",\"description\":\"Specifies that the content is deprecated and SHOULD be transitioned out of usage. Default value is `false`.\",\"type\":\"boolean\",\"default\":false}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/specificationExtension\"}}}}}" diff --git a/generated/packages/py/CHANGELOG.md b/generated/packages/py/CHANGELOG.md new file mode 100644 index 0000000..e69de29 diff --git a/generated/packages/py/pyproject.toml b/generated/packages/py/pyproject.toml new file mode 100644 index 0000000..7f3ef0b --- /dev/null +++ b/generated/packages/py/pyproject.toml @@ -0,0 +1,10 @@ +[build-system] +requires = [ "hatchling" ] +build-backend = "hatchling.build" + +[project] +name = "open-rpc-spec-types" +version = "0.0.0" +description = "Generated OpenRPC specification types" +license = "Apache-2.0" +requires-python = ">=3.12" diff --git a/generated/packages/py/src/open_rpc_spec_types/__init__.py b/generated/packages/py/src/open_rpc_spec_types/__init__.py new file mode 100644 index 0000000..7f5ede2 --- /dev/null +++ b/generated/packages/py/src/open_rpc_spec_types/__init__.py @@ -0,0 +1,2 @@ +from . import v1_4 +from . import v1_3 diff --git a/generated/packages/py/src/open_rpc_spec_types/v1_3.py b/generated/packages/py/src/open_rpc_spec_types/v1_3.py new file mode 100644 index 0000000..c6bbfe1 --- /dev/null +++ b/generated/packages/py/src/open_rpc_spec_types/v1_3.py @@ -0,0 +1,437 @@ +from typing import TypedDict +from typing import Optional +from enum import Enum +from typing import NewType +from typing import Any +from typing import List +from typing import Mapping +from typing import Union + +class Openrpc(Enum): + OneThreeTwo = 0 + OneThreeOne = 1 + OneThreeZero = 2 + OneTwoSix = 3 + OneTwoFive = 4 + OneTwoFour = 5 + OneTwoThree = 6 + OneTwoTwo = 7 + OneTwoOne = 8 + OneTwoZero = 9 + OneOneOneTwo = 10 + OneOneOneOne = 11 + OneOneOneZero = 12 + OneOneNine = 13 + OneOneEight = 14 + OneOneSeven = 15 + OneOneSix = 16 + OneOneFive = 17 + OneOneFour = 18 + OneOneThree = 19 + OneOneTwo = 20 + OneOneOne = 21 + OneOneZero = 22 + OneZeroZero = 23 + OneZeroZeroRcZero = 24 + OneZeroZeroRcOne = 25 + +InfoObjectProperties = NewType("InfoObjectProperties", str) + +InfoObjectDescription = NewType("InfoObjectDescription", str) + +InfoObjectTermsOfService = NewType("InfoObjectTermsOfService", str) + +InfoObjectVersion = NewType("InfoObjectVersion", str) + +ContactObjectName = NewType("ContactObjectName", str) + +ContactObjectEmail = NewType("ContactObjectEmail", str) + +ContactObjectUrl = NewType("ContactObjectUrl", str) + +SpecificationExtension = NewType("SpecificationExtension", Any) + +class ContactObject(TypedDict): + name: Optional[ContactObjectName] + email: Optional[ContactObjectEmail] + url: Optional[ContactObjectUrl] + +LicenseObjectName = NewType("LicenseObjectName", str) + +LicenseObjectUrl = NewType("LicenseObjectUrl", str) + +class LicenseObject(TypedDict): + name: Optional[LicenseObjectName] + url: Optional[LicenseObjectUrl] + +class InfoObject(TypedDict): + title: Optional[InfoObjectProperties] + description: Optional[InfoObjectDescription] + termsOfService: Optional[InfoObjectTermsOfService] + version: Optional[InfoObjectVersion] + contact: Optional[ContactObject] + license: Optional[LicenseObject] + +ExternalDocumentationObjectDescription = NewType("ExternalDocumentationObjectDescription", str) + +ExternalDocumentationObjectUrl = NewType("ExternalDocumentationObjectUrl", str) +"""information about external documentation +""" +class ExternalDocumentationObject(TypedDict): + description: Optional[ExternalDocumentationObjectDescription] + url: Optional[ExternalDocumentationObjectUrl] + +ServerObjectUrl = NewType("ServerObjectUrl", str) + +ServerObjectName = NewType("ServerObjectName", str) + +ServerObjectDescription = NewType("ServerObjectDescription", str) + +ServerObjectSummary = NewType("ServerObjectSummary", str) + +ServerObjectVariableDefault = NewType("ServerObjectVariableDefault", str) + +ServerObjectVariableDescription = NewType("ServerObjectVariableDescription", str) + +ServerObjectVariableEnumItem = NewType("ServerObjectVariableEnumItem", str) + +ServerObjectVariableEnum = NewType("ServerObjectVariableEnum", List[ServerObjectVariableEnumItem]) + +class ServerObjectVariable(TypedDict): + default: Optional[ServerObjectVariableDefault] + description: Optional[ServerObjectVariableDescription] + enum: Optional[ServerObjectVariableEnum] + +ServerObjectVariables = NewType("ServerObjectVariables", Mapping[Any, Any]) + +class ServerObject(TypedDict): + url: Optional[ServerObjectUrl] + name: Optional[ServerObjectName] + description: Optional[ServerObjectDescription] + summary: Optional[ServerObjectSummary] + variables: Optional[ServerObjectVariables] +AlwaysFalse = NewType("AlwaysFalse", Any) + +Servers = NewType("Servers", List[ServerObject]) +"""The cannonical name for the method. The name MUST be unique within the methods array. +""" +MethodObjectName = NewType("MethodObjectName", str) +"""A verbose explanation of the method behavior. GitHub Flavored Markdown syntax MAY be used for rich text representation. +""" +MethodObjectDescription = NewType("MethodObjectDescription", str) +"""A short summary of what the method does. +""" +MethodObjectSummary = NewType("MethodObjectSummary", str) + +TagObjectName = NewType("TagObjectName", str) + +TagObjectDescription = NewType("TagObjectDescription", str) + +class TagObject(TypedDict): + name: Optional[TagObjectName] + description: Optional[TagObjectDescription] + externalDocs: Optional[ExternalDocumentationObject] + +Ref = NewType("Ref", str) + +class ReferenceObject(TypedDict): + $ref: undefined + +TagOrReference = NewType("TagOrReference", Union[TagObject, ReferenceObject]) + +MethodObjectTags = NewType("MethodObjectTags", List[TagOrReference]) +"""Format the server expects the params. Defaults to 'either'. +""" +class MethodObjectParamStructure(Enum): + ByPosition = 0 + ByName = 1 + Either = 2 + +ContentDescriptorObjectName = NewType("ContentDescriptorObjectName", str) + +ContentDescriptorObjectDescription = NewType("ContentDescriptorObjectDescription", str) + +ContentDescriptorObjectSummary = NewType("ContentDescriptorObjectSummary", str) + +Id = NewType("Id", str) + +Schema = NewType("Schema", str) + +Comment = NewType("Comment", str) + +Title = NewType("Title", str) + +Description = NewType("Description", str) +AlwaysTrue = NewType("AlwaysTrue", Any) + +ReadOnly = NewType("ReadOnly", bool) + +Examples = NewType("Examples", List[AlwaysTrue]) + +MultipleOf = NewType("MultipleOf", float) + +Maximum = NewType("Maximum", float) + +ExclusiveMaximum = NewType("ExclusiveMaximum", float) + +Minimum = NewType("Minimum", float) + +ExclusiveMinimum = NewType("ExclusiveMinimum", float) + +NonNegativeInteger = NewType("NonNegativeInteger", int) + +NonNegativeIntegerDefaultZero = NewType("NonNegativeIntegerDefaultZero", int) + +Pattern = NewType("Pattern", str) + +SchemaArray = NewType("SchemaArray", List[JSONSchema]) + +Items = NewType("Items", Union[JSONSchema, SchemaArray]) + +UniqueItems = NewType("UniqueItems", bool) + +StringDoaGddGA = NewType("StringDoaGddGA", str) + +StringArray = NewType("StringArray", List[StringDoaGddGA]) + +Definitions = NewType("Definitions", Mapping[Any, Any]) + +Properties = NewType("Properties", Mapping[Any, Any]) + +PropertyNames = NewType("PropertyNames", Any) + +PatternProperties = NewType("PatternProperties", Mapping[Any, Any]) + +DependenciesSet = NewType("DependenciesSet", Union[JSONSchema, StringArray]) + +Dependencies = NewType("Dependencies", Mapping[Any, Any]) + +Enum = NewType("Enum", List[AlwaysTrue]) + +class SimpleTypes(Enum): + Array = 0 + Boolean = 1 + Integer = 2 + Null = 3 + Number = 4 + Object = 5 + String = 6 + +ArrayOfSimpleTypes = NewType("ArrayOfSimpleTypes", List[SimpleTypes]) + +Type = NewType("Type", Union[SimpleTypes, ArrayOfSimpleTypes]) + +Format = NewType("Format", str) + +ContentMediaType = NewType("ContentMediaType", str) + +ContentEncoding = NewType("ContentEncoding", str) + +class JSONSchemaObject(TypedDict): + $id: Optional[Id] + $schema: Optional[Schema] + $ref: Optional[Ref] + $comment: Optional[Comment] + title: Optional[Title] + description: Optional[Description] + default: Optional[AlwaysTrue] + readOnly: Optional[ReadOnly] + examples: Optional[Examples] + multipleOf: Optional[MultipleOf] + maximum: Optional[Maximum] + exclusiveMaximum: Optional[ExclusiveMaximum] + minimum: Optional[Minimum] + exclusiveMinimum: Optional[ExclusiveMinimum] + maxLength: Optional[NonNegativeInteger] + minLength: Optional[NonNegativeIntegerDefaultZero] + pattern: Optional[Pattern] + additionalItems: Optional[JSONSchema] + items: Optional[Items] + maxItems: Optional[NonNegativeInteger] + minItems: Optional[NonNegativeIntegerDefaultZero] + uniqueItems: Optional[UniqueItems] + contains: Optional[JSONSchema] + maxProperties: Optional[NonNegativeInteger] + minProperties: Optional[NonNegativeIntegerDefaultZero] + required: Optional[StringArray] + additionalProperties: Optional[JSONSchema] + definitions: Optional[Definitions] + properties: Optional[Properties] + patternProperties: Optional[PatternProperties] + dependencies: Optional[Dependencies] + propertyNames: Optional[JSONSchema] + const: Optional[AlwaysTrue] + enum: Optional[Enum] + type: Optional[Type] + format: Optional[Format] + contentMediaType: Optional[ContentMediaType] + contentEncoding: Optional[ContentEncoding] + if: Optional[JSONSchema] + then: Optional[JSONSchema] + else: Optional[JSONSchema] + allOf: Optional[SchemaArray] + anyOf: Optional[SchemaArray] + oneOf: Optional[SchemaArray] + not: Optional[JSONSchema] +"""Always valid if true. Never valid if false. Is constant. +""" +JSONSchemaBoolean = NewType("JSONSchemaBoolean", bool) + +JSONSchema = NewType("JSONSchema", Union[JSONSchemaObject, JSONSchemaBoolean]) + +ContentDescriptorObjectRequired = NewType("ContentDescriptorObjectRequired", bool) + +ContentDescriptorObjectDeprecated = NewType("ContentDescriptorObjectDeprecated", bool) + +class ContentDescriptorObject(TypedDict): + name: Optional[ContentDescriptorObjectName] + description: Optional[ContentDescriptorObjectDescription] + summary: Optional[ContentDescriptorObjectSummary] + schema: Optional[JSONSchema] + required: Optional[ContentDescriptorObjectRequired] + deprecated: Optional[ContentDescriptorObjectDeprecated] + +ContentDescriptorOrReference = NewType("ContentDescriptorOrReference", Union[ContentDescriptorObject, ReferenceObject]) + +MethodObjectParams = NewType("MethodObjectParams", List[ContentDescriptorOrReference]) + +MethodObjectResult = NewType("MethodObjectResult", Union[ContentDescriptorObject, ReferenceObject]) +"""A Number that indicates the error type that occurred. This MUST be an integer. The error codes from and including -32768 to -32000 are reserved for pre-defined errors. These pre-defined errors SHOULD be assumed to be returned from any JSON-RPC api. +""" +ErrorObjectCode = NewType("ErrorObjectCode", int) +"""A String providing a short description of the error. The message SHOULD be limited to a concise single sentence. +""" +ErrorObjectMessage = NewType("ErrorObjectMessage", str) +"""A Primitive or Structured value that contains additional information about the error. This may be omitted. The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.). +""" +ErrorObjectData = NewType("ErrorObjectData", Any) +"""Defines an application level error. +""" +class ErrorObject(TypedDict): + code: Optional[ErrorObjectCode] + message: Optional[ErrorObjectMessage] + data: Optional[ErrorObjectData] + +ErrorOrReference = NewType("ErrorOrReference", Union[ErrorObject, ReferenceObject]) +"""Defines an application level error. +""" +MethodObjectErrors = NewType("MethodObjectErrors", List[ErrorOrReference]) + +LinkObjectName = NewType("LinkObjectName", str) + +LinkObjectSummary = NewType("LinkObjectSummary", str) + +LinkObjectMethod = NewType("LinkObjectMethod", str) + +LinkObjectDescription = NewType("LinkObjectDescription", str) + +LinkObjectParams = NewType("LinkObjectParams", Any) + +class LinkObjectServer(TypedDict): + url: Optional[ServerObjectUrl] + name: Optional[ServerObjectName] + description: Optional[ServerObjectDescription] + summary: Optional[ServerObjectSummary] + variables: Optional[ServerObjectVariables] + +class LinkObject(TypedDict): + name: Optional[LinkObjectName] + summary: Optional[LinkObjectSummary] + method: Optional[LinkObjectMethod] + description: Optional[LinkObjectDescription] + params: Optional[LinkObjectParams] + server: Optional[LinkObjectServer] + +LinkOrReference = NewType("LinkOrReference", Union[LinkObject, ReferenceObject]) + +MethodObjectLinks = NewType("MethodObjectLinks", List[LinkOrReference]) + +ExamplePairingObjectName = NewType("ExamplePairingObjectName", str) + +ExamplePairingObjectDescription = NewType("ExamplePairingObjectDescription", str) + +ExampleObjectSummary = NewType("ExampleObjectSummary", str) + +ExampleObjectValue = NewType("ExampleObjectValue", Any) + +ExampleObjectDescription = NewType("ExampleObjectDescription", str) + +ExampleObjectName = NewType("ExampleObjectName", str) + +class ExampleObject(TypedDict): + summary: Optional[ExampleObjectSummary] + value: Optional[ExampleObjectValue] + description: Optional[ExampleObjectDescription] + name: Optional[ExampleObjectName] + +ExampleOrReference = NewType("ExampleOrReference", Union[ExampleObject, ReferenceObject]) + +ExamplePairingObjectParams = NewType("ExamplePairingObjectParams", List[ExampleOrReference]) + +ExamplePairingObjectResult = NewType("ExamplePairingObjectResult", Union[ExampleObject, ReferenceObject]) + +class ExamplePairingObject(TypedDict): + name: Optional[ExamplePairingObjectName] + description: Optional[ExamplePairingObjectDescription] + params: Optional[ExamplePairingObjectParams] + result: Optional[ExamplePairingObjectResult] + +ExamplePairingOrReference = NewType("ExamplePairingOrReference", Union[ExamplePairingObject, ReferenceObject]) + +MethodObjectExamples = NewType("MethodObjectExamples", List[ExamplePairingOrReference]) + +MethodObjectDeprecated = NewType("MethodObjectDeprecated", bool) + +class MethodObject(TypedDict): + name: Optional[MethodObjectName] + description: Optional[MethodObjectDescription] + summary: Optional[MethodObjectSummary] + servers: Optional[Servers] + tags: Optional[MethodObjectTags] + paramStructure: Optional[MethodObjectParamStructure] + params: Optional[MethodObjectParams] + result: Optional[MethodObjectResult] + errors: Optional[MethodObjectErrors] + links: Optional[MethodObjectLinks] + examples: Optional[MethodObjectExamples] + deprecated: Optional[MethodObjectDeprecated] + externalDocs: Optional[ExternalDocumentationObject] + +MethodOrReference = NewType("MethodOrReference", Union[MethodObject, ReferenceObject]) + +Methods = NewType("Methods", List[MethodOrReference]) + +SchemaComponents = NewType("SchemaComponents", Mapping[Any, Any]) + +LinkComponents = NewType("LinkComponents", Mapping[Any, Any]) + +ErrorComponents = NewType("ErrorComponents", Mapping[Any, Any]) + +ExampleComponents = NewType("ExampleComponents", Mapping[Any, Any]) + +ExamplePairingComponents = NewType("ExamplePairingComponents", Mapping[Any, Any]) + +ContentDescriptorComponents = NewType("ContentDescriptorComponents", Mapping[Any, Any]) + +TagComponents = NewType("TagComponents", Mapping[Any, Any]) + +class Components(TypedDict): + schemas: Optional[SchemaComponents] + links: Optional[LinkComponents] + errors: Optional[ErrorComponents] + examples: Optional[ExampleComponents] + examplePairings: Optional[ExamplePairingComponents] + contentDescriptors: Optional[ContentDescriptorComponents] + tags: Optional[TagComponents] +"""JSON Schema URI (used by some editors) +""" +MetaSchema = NewType("MetaSchema", str) + +class OpenrpcDocument(TypedDict): + openrpc: undefined + info: Optional[InfoObject] + externalDocs: Optional[ExternalDocumentationObject] + servers: Optional[Servers] + methods: undefined + components: Optional[Components] + $schema: Optional[MetaSchema] \ No newline at end of file diff --git a/generated/packages/py/src/open_rpc_spec_types/v1_4.py b/generated/packages/py/src/open_rpc_spec_types/v1_4.py new file mode 100644 index 0000000..de8013a --- /dev/null +++ b/generated/packages/py/src/open_rpc_spec_types/v1_4.py @@ -0,0 +1,472 @@ +from typing import TypedDict +from typing import Optional +from typing import NewType +from typing import Any +from typing import List +from typing import Mapping +from typing import Union +from enum import Enum +"""This string MUST be the [semantic version number](https://semver.org/spec/v2.0.0.html) of the [OpenRPC Specification version](#versions) that the OpenRPC document uses. The `openrpc` field SHOULD be used by tooling specifications and clients to interpret the OpenRPC document. This is *not* related to the API [`info.version`](#info-version) string. +""" +Openrpc = NewType("Openrpc", str) +"""The title of the application. +""" +InfoObjectTitle = NewType("InfoObjectTitle", str) +"""A verbose description of the application. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +""" +InfoObjectDescription = NewType("InfoObjectDescription", str) +"""A URL to the Terms of Service for the API. MUST be in the format of a URL. +""" +InfoObjectTermsOfService = NewType("InfoObjectTermsOfService", str) +"""The version of the OpenRPC document (which is distinct from the [OpenRPC Specification version](#openrpc-document-openrpc) or the API implementation version). +""" +InfoObjectVersion = NewType("InfoObjectVersion", str) +"""The identifying name of the contact person/organization. +""" +ContactObjectName = NewType("ContactObjectName", str) +"""The email address of the contact person/organization. MUST be in the format of an email address. +""" +ContactObjectEmail = NewType("ContactObjectEmail", str) +"""The URL pointing to the contact information. MUST be in the format of a URL. +""" +ContactObjectUrl = NewType("ContactObjectUrl", str) +"""This object MAY be extended with [Specification Extensions](#specification-extensions). +""" +SpecificationExtension = NewType("SpecificationExtension", Any) +"""Contact information for the exposed API. +""" +class ContactObject(TypedDict): + name: Optional[ContactObjectName] + email: Optional[ContactObjectEmail] + url: Optional[ContactObjectUrl] +"""The license name used for the API. +""" +LicenseObjectName = NewType("LicenseObjectName", str) +"""A URL to the license used for the API. MUST be in the format of a URL. +""" +LicenseObjectUrl = NewType("LicenseObjectUrl", str) +"""License information for the exposed API. +""" +class LicenseObject(TypedDict): + name: Optional[LicenseObjectName] + url: Optional[LicenseObjectUrl] +"""The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience. +""" +InfoObject = NewType("InfoObject", Any) +"""A verbose explanation of the documentation. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +""" +ExternalDocumentationObjectDescription = NewType("ExternalDocumentationObjectDescription", str) +"""The URL for the target documentation. Value MUST be in the format of a URL. +""" +ExternalDocumentationObjectUrl = NewType("ExternalDocumentationObjectUrl", str) +"""Additional external documentation for this tag. +""" +class ExternalDocumentationObject(TypedDict): + description: Optional[ExternalDocumentationObjectDescription] + url: Optional[ExternalDocumentationObjectUrl] +"""A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenRPC document is being served. [Server Variables](#server-variables) are passed into the [Runtime Expression](#runtime-expression) to produce a server URL. +""" +ServerObjectUrl = NewType("ServerObjectUrl", str) +"""An optional string describing the name of the server. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +""" +ServerObjectName = NewType("ServerObjectName", str) +"""An optional string describing the host designated by the URL. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +""" +ServerObjectDescription = NewType("ServerObjectDescription", str) +"""A short summary of what the server is. +""" +ServerObjectSummary = NewType("ServerObjectSummary", str) +"""The default value to use for substitution, which SHALL be sent if an alternate value is _not_ supplied. Note this behavior is different than the [Schema Object's](#schema-object) treatment of default values, because in those cases parameter values are optional. +""" +ServerObjectVariableDefault = NewType("ServerObjectVariableDefault", str) +"""An optional description for the server variable. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +""" +ServerObjectVariableDescription = NewType("ServerObjectVariableDescription", str) +"""An enumeration of string values to be used if the substitution options are from a limited set. +""" +ServerObjectVariableEnumItem = NewType("ServerObjectVariableEnumItem", str) +"""An enumeration of string values to be used if the substitution options are from a limited set. +""" +ServerObjectVariableEnum = NewType("ServerObjectVariableEnum", List[ServerObjectVariableEnumItem]) +"""An object representing a Server Variable for server URL template substitution. +""" +class ServerObjectVariable(TypedDict): + default: Optional[ServerObjectVariableDefault] + description: Optional[ServerObjectVariableDescription] + enum: Optional[ServerObjectVariableEnum] +"""A map between a variable name and its value. The value is passed into the [Runtime Expression](#runtime-expression) to produce a server URL. +""" +ServerObjectVariables = NewType("ServerObjectVariables", Mapping[Any, Any]) +"""A object representing a Server +""" +class ServerObject(TypedDict): + url: Optional[ServerObjectUrl] + name: Optional[ServerObjectName] + description: Optional[ServerObjectDescription] + summary: Optional[ServerObjectSummary] + variables: Optional[ServerObjectVariables] +AlwaysFalse = NewType("AlwaysFalse", Any) +"""An array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](#server-object) with a [url](#server-url) value of `localhost`. +""" +Servers = NewType("Servers", List[ServerObject]) +"""The cannonical name for the method. The name MUST be unique within the methods array. +""" +MethodObjectName = NewType("MethodObjectName", str) +"""A verbose explanation of the method behavior. GitHub Flavored Markdown syntax MAY be used for rich text representation. +""" +MethodObjectDescription = NewType("MethodObjectDescription", str) +"""A short summary of what the method does. +""" +MethodObjectSummary = NewType("MethodObjectSummary", str) +"""The name of the tag. +""" +TagObjectName = NewType("TagObjectName", str) +"""A verbose explanation for the tag. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +""" +TagObjectDescription = NewType("TagObjectDescription", str) +"""Adds metadata to a single tag that is used by the [Method Object](#method-object). It is not mandatory to have a Tag Object per tag defined in the Method Object instances. +""" +class TagObject(TypedDict): + name: Optional[TagObjectName] + description: Optional[TagObjectDescription] + externalDocs: Optional[ExternalDocumentationObject] + +Ref = NewType("Ref", str) + +class ReferenceObject(TypedDict): + $ref: undefined + +TagOrReference = NewType("TagOrReference", Union[TagObject, ReferenceObject]) +"""A list of tags for API documentation control. Tags can be used for logical grouping of methods by resources or any other qualifier. +""" +MethodObjectTags = NewType("MethodObjectTags", List[TagOrReference]) +"""Format the server expects the params. Defaults to 'either'. +""" +class MethodObjectParamStructure(Enum): + ByPosition = 0 + ByName = 1 + Either = 2 +"""Name of the content that is being described. If the content described is a method parameter assignable [`by-name`](#method-param-structure), this field SHALL define the parameter's key (ie name). +""" +ContentDescriptorObjectName = NewType("ContentDescriptorObjectName", str) +"""A verbose explanation of the content descriptor behavior. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +""" +ContentDescriptorObjectDescription = NewType("ContentDescriptorObjectDescription", str) +"""A short summary of the content that is being described. +""" +ContentDescriptorObjectSummary = NewType("ContentDescriptorObjectSummary", str) + +Id = NewType("Id", str) + +Schema = NewType("Schema", str) + +Comment = NewType("Comment", str) + +Title = NewType("Title", str) + +Description = NewType("Description", str) +AlwaysTrue = NewType("AlwaysTrue", Any) + +ReadOnly = NewType("ReadOnly", bool) + +Examples = NewType("Examples", List[AlwaysTrue]) + +MultipleOf = NewType("MultipleOf", float) + +Maximum = NewType("Maximum", float) + +ExclusiveMaximum = NewType("ExclusiveMaximum", float) + +Minimum = NewType("Minimum", float) + +ExclusiveMinimum = NewType("ExclusiveMinimum", float) + +NonNegativeInteger = NewType("NonNegativeInteger", int) + +NonNegativeIntegerDefaultZero = NewType("NonNegativeIntegerDefaultZero", int) + +Pattern = NewType("Pattern", str) +"""Always valid if true. Never valid if false. Is constant. +""" +JSONSchemaBoolean = NewType("JSONSchemaBoolean", bool) + +JSONSchema = NewType("JSONSchema", Union[JSONSchemaObject, JSONSchemaBoolean]) + +SchemaArray = NewType("SchemaArray", List[JSONSchema]) + +Items = NewType("Items", Union[JSONSchema, SchemaArray]) + +UniqueItems = NewType("UniqueItems", bool) + +StringDoaGddGA = NewType("StringDoaGddGA", str) + +StringArray = NewType("StringArray", List[StringDoaGddGA]) + +Definitions = NewType("Definitions", Mapping[Any, Any]) + +Properties = NewType("Properties", Mapping[Any, Any]) + +PropertyNames = NewType("PropertyNames", Any) + +PatternProperties = NewType("PatternProperties", Mapping[Any, Any]) + +DependenciesSet = NewType("DependenciesSet", Union[JSONSchema, StringArray]) + +Dependencies = NewType("Dependencies", Mapping[Any, Any]) + +Enum = NewType("Enum", List[AlwaysTrue]) + +class SimpleTypes(Enum): + Array = 0 + Boolean = 1 + Integer = 2 + Null = 3 + Number = 4 + Object = 5 + String = 6 + +ArrayOfSimpleTypes = NewType("ArrayOfSimpleTypes", List[SimpleTypes]) + +Type = NewType("Type", Union[SimpleTypes, ArrayOfSimpleTypes]) + +Format = NewType("Format", str) + +ContentMediaType = NewType("ContentMediaType", str) + +ContentEncoding = NewType("ContentEncoding", str) + +class JSONSchemaObject(TypedDict): + $id: Optional[Id] + $schema: Optional[Schema] + $ref: Optional[Ref] + $comment: Optional[Comment] + title: Optional[Title] + description: Optional[Description] + default: Optional[AlwaysTrue] + readOnly: Optional[ReadOnly] + examples: Optional[Examples] + multipleOf: Optional[MultipleOf] + maximum: Optional[Maximum] + exclusiveMaximum: Optional[ExclusiveMaximum] + minimum: Optional[Minimum] + exclusiveMinimum: Optional[ExclusiveMinimum] + maxLength: Optional[NonNegativeInteger] + minLength: Optional[NonNegativeIntegerDefaultZero] + pattern: Optional[Pattern] + additionalItems: Optional[JSONSchema] + items: Optional[Items] + maxItems: Optional[NonNegativeInteger] + minItems: Optional[NonNegativeIntegerDefaultZero] + uniqueItems: Optional[UniqueItems] + contains: Optional[JSONSchema] + maxProperties: Optional[NonNegativeInteger] + minProperties: Optional[NonNegativeIntegerDefaultZero] + required: Optional[StringArray] + additionalProperties: Optional[JSONSchema] + definitions: Optional[Definitions] + properties: Optional[Properties] + patternProperties: Optional[PatternProperties] + dependencies: Optional[Dependencies] + propertyNames: Optional[JSONSchema] + const: Optional[AlwaysTrue] + enum: Optional[Enum] + type: Optional[Type] + format: Optional[Format] + contentMediaType: Optional[ContentMediaType] + contentEncoding: Optional[ContentEncoding] + if: Optional[JSONSchema] + then: Optional[JSONSchema] + else: Optional[JSONSchema] + allOf: Optional[SchemaArray] + anyOf: Optional[SchemaArray] + oneOf: Optional[SchemaArray] + not: Optional[JSONSchema] +"""Schema that describes the content. +""" +ContentDescriptorObjectSchema = NewType("ContentDescriptorObjectSchema", Union[JSONSchemaObject, JSONSchemaBoolean]) +"""Determines if the content is a required field. Default value is `false`. +""" +ContentDescriptorObjectRequired = NewType("ContentDescriptorObjectRequired", bool) +"""Specifies that the content is deprecated and SHOULD be transitioned out of usage. Default value is `false`. +""" +ContentDescriptorObjectDeprecated = NewType("ContentDescriptorObjectDeprecated", bool) +"""Content Descriptors are objects that do just as they suggest - describe content. They are reusable ways of describing either parameters or result. They MUST have a schema. +""" +class ContentDescriptorObject(TypedDict): + name: Optional[ContentDescriptorObjectName] + description: Optional[ContentDescriptorObjectDescription] + summary: Optional[ContentDescriptorObjectSummary] + schema: Optional[ContentDescriptorObjectSchema] + required: Optional[ContentDescriptorObjectRequired] + deprecated: Optional[ContentDescriptorObjectDeprecated] + +ContentDescriptorOrReference = NewType("ContentDescriptorOrReference", Union[ContentDescriptorObject, ReferenceObject]) +""" A list of parameters that are applicable for this method. The list MUST NOT include duplicated parameters and therefore require [name](#content-descriptor-name) to be unique. The list can use the [Reference Object](#reference-object) to link to parameters that are defined by the [Content Descriptor Object](#content-descriptor-object). All optional params (content descriptor objects with "required": false) MUST be positioned after all required params in the list. +""" +MethodObjectParams = NewType("MethodObjectParams", List[ContentDescriptorOrReference]) +"""The description of the result returned by the method. If defined, it MUST be a Content Descriptor or Reference Object. If undefined, the method MUST only be used as a [notification](https://www.jsonrpc.org/specification#notification) +""" +MethodObjectResult = NewType("MethodObjectResult", Union[ContentDescriptorObject, ReferenceObject]) +"""A Number that indicates the error type that occurred. This MUST be an integer. The error codes from and including -32768 to -32000 are reserved for pre-defined errors. These pre-defined errors SHOULD be assumed to be returned from any JSON-RPC api. +""" +ErrorObjectCode = NewType("ErrorObjectCode", int) +"""A String providing a short description of the error. The message SHOULD be limited to a concise single sentence. +""" +ErrorObjectMessage = NewType("ErrorObjectMessage", str) +"""A Primitive or Structured value that contains additional information about the error. This may be omitted. The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.). +""" +ErrorObjectData = NewType("ErrorObjectData", Any) +"""Defines an application level error. +""" +class ErrorObject(TypedDict): + code: Optional[ErrorObjectCode] + message: Optional[ErrorObjectMessage] + data: Optional[ErrorObjectData] + +ErrorOrReference = NewType("ErrorOrReference", Union[ErrorObject, ReferenceObject]) +"""A list of custom application defined errors that MAY be returned. The Errors MUST have unique error codes. +""" +MethodObjectErrors = NewType("MethodObjectErrors", List[ErrorOrReference]) +"""Cannonical name of the link. +""" +LinkObjectName = NewType("LinkObjectName", Any) +"""Short description for the link. +""" +LinkObjectSummary = NewType("LinkObjectSummary", str) +"""The name of an existing, resolvable OpenRPC method, as defined with a unique `method`. This field MUST resolve to a unique [Method Object](#method-object). As opposed to Open Api, Relative `method` values ARE NOT permitted. +""" +LinkObjectMethod = NewType("LinkObjectMethod", str) +"""A description of the link. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +""" +LinkObjectDescription = NewType("LinkObjectDescription", str) +"""A map representing parameters to pass to a method as specified with `method`. The key is the parameter name to be used, whereas the value can be a constant or a [runtime expression](#runtime-expression) to be evaluated and passed to the linked method. +""" +LinkObjectParams = NewType("LinkObjectParams", Any) +"""A server object to be used by the target method. +""" +class LinkObjectServer(TypedDict): + url: Optional[ServerObjectUrl] + name: Optional[ServerObjectName] + description: Optional[ServerObjectDescription] + summary: Optional[ServerObjectSummary] + variables: Optional[ServerObjectVariables] +"""A object representing a Link +""" +LinkObject = NewType("LinkObject", Any) + +LinkOrReference = NewType("LinkOrReference", Union[LinkObject, ReferenceObject]) +"""A list of possible links from this method call. +""" +MethodObjectLinks = NewType("MethodObjectLinks", List[LinkOrReference]) +"""Name for the example pairing. +""" +ExamplePairingObjectName = NewType("ExamplePairingObjectName", str) +"""A verbose explanation of the example pairing. +""" +ExamplePairingObjectDescription = NewType("ExamplePairingObjectDescription", str) +"""Short description for the example. +""" +ExampleObjectSummary = NewType("ExampleObjectSummary", str) +"""Embedded literal example. The `value` field and `externalValue` field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON, use a string value to contain the example, escaping where necessary. +""" +ExampleObjectValue = NewType("ExampleObjectValue", Any) +"""A verbose explanation of the example. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +""" +ExampleObjectDescription = NewType("ExampleObjectDescription", str) +"""Cannonical name of the example. +""" +ExampleObjectName = NewType("ExampleObjectName", str) +"""The Example object is an object that defines an example that is intended to match the `schema` of a given [Content Descriptor](#content-descriptor-object). +""" +class ExampleObject(TypedDict): + summary: Optional[ExampleObjectSummary] + value: Optional[ExampleObjectValue] + description: Optional[ExampleObjectDescription] + name: Optional[ExampleObjectName] + +ExampleOrReference = NewType("ExampleOrReference", Union[ExampleObject, ReferenceObject]) +"""Example parameters. +""" +ExamplePairingObjectParams = NewType("ExamplePairingObjectParams", List[ExampleOrReference]) +"""Example result. When not provided, the example pairing represents usage of the method as a notification. +""" +ExamplePairingObjectResult = NewType("ExamplePairingObjectResult", Union[ExampleObject, ReferenceObject]) +"""The Example Pairing object consists of a set of example params and result. The result is what you can expect from the JSON-RPC service given the exact params. +""" +class ExamplePairingObject(TypedDict): + name: Optional[ExamplePairingObjectName] + description: Optional[ExamplePairingObjectDescription] + params: Optional[ExamplePairingObjectParams] + result: Optional[ExamplePairingObjectResult] + +ExamplePairingOrReference = NewType("ExamplePairingOrReference", Union[ExamplePairingObject, ReferenceObject]) +"""Array of [Example Pairing Objects](#example-pairing-object) where each example includes a valid params-to-result [Content Descriptor](#content-descriptor-object) pairing. +""" +MethodObjectExamples = NewType("MethodObjectExamples", List[ExamplePairingOrReference]) +"""Declares this method to be deprecated. Consumers SHOULD refrain from usage of the declared method. Default value is `false`. +""" +MethodObjectDeprecated = NewType("MethodObjectDeprecated", bool) +"""Describes the interface for the given method name. The method name is used as the `method` field of the JSON-RPC body. It therefore MUST be unique. +""" +class MethodObject(TypedDict): + name: Optional[MethodObjectName] + description: Optional[MethodObjectDescription] + summary: Optional[MethodObjectSummary] + servers: Optional[Servers] + tags: Optional[MethodObjectTags] + paramStructure: Optional[MethodObjectParamStructure] + params: Optional[MethodObjectParams] + result: Optional[MethodObjectResult] + errors: Optional[MethodObjectErrors] + links: Optional[MethodObjectLinks] + examples: Optional[MethodObjectExamples] + deprecated: Optional[MethodObjectDeprecated] + externalDocs: Optional[ExternalDocumentationObject] + +MethodOrReference = NewType("MethodOrReference", Union[MethodObject, ReferenceObject]) +"""The available methods for the API. While it is required, the array may be empty (to handle security filtering, for example). +""" +Methods = NewType("Methods", List[MethodOrReference]) +"""An object to hold reusable [Schema Objects](#schema-object). +""" +SchemaComponents = NewType("SchemaComponents", Mapping[Any, Any]) +"""An object to hold reusable [Link Objects](#link-object). +""" +LinkComponents = NewType("LinkComponents", Mapping[Any, Any]) +"""An object to hold reusable [Error Objects](#error-object). +""" +ErrorComponents = NewType("ErrorComponents", Mapping[Any, Any]) +"""An object to hold reusable [Example Objects](#example-object). +""" +ExampleComponents = NewType("ExampleComponents", Mapping[Any, Any]) +"""An object to hold reusable [Example Pairing Objects](#example-pairing-object). +""" +ExamplePairingComponents = NewType("ExamplePairingComponents", Mapping[Any, Any]) +"""An object to hold reusable [Content Descriptor Objects](#content-descriptor-object). +""" +ContentDescriptorComponents = NewType("ContentDescriptorComponents", Mapping[Any, Any]) +"""An object to hold reusable [Tag Objects](#tag-object). +""" +TagComponents = NewType("TagComponents", Mapping[Any, Any]) +"""Holds a set of reusable objects for different aspects of the OpenRPC. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object. +""" +class Components(TypedDict): + schemas: Optional[SchemaComponents] + links: Optional[LinkComponents] + errors: Optional[ErrorComponents] + examples: Optional[ExampleComponents] + examplePairings: Optional[ExamplePairingComponents] + contentDescriptors: Optional[ContentDescriptorComponents] + tags: Optional[TagComponents] +"""JSON Schema URI (used by some editors) +""" +MetaSchema = NewType("MetaSchema", str) + +class OpenrpcDocument(TypedDict): + openrpc: undefined + info: Optional[InfoObject] + externalDocs: Optional[ExternalDocumentationObject] + servers: Optional[Servers] + methods: undefined + components: Optional[Components] + $schema: Optional[MetaSchema] \ No newline at end of file diff --git a/generated/packages/rs/CHANGELOG.md b/generated/packages/rs/CHANGELOG.md new file mode 100644 index 0000000..e69de29 diff --git a/generated/packages/rs/Cargo.toml b/generated/packages/rs/Cargo.toml new file mode 100644 index 0000000..461b6e3 --- /dev/null +++ b/generated/packages/rs/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "open-rpc-spec-types" +version = "0.0.0" +edition = "2021" +description = "Generated OpenRPC specification types" +license = "Apache-2.0" + +[dependencies] +serde_json = "1.0" +derive_builder = "0.20" + + [dependencies.serde] + version = "1.0" + features = [ "derive" ] diff --git a/generated/packages/rs/src/lib.rs b/generated/packages/rs/src/lib.rs new file mode 100644 index 0000000..8e8426c --- /dev/null +++ b/generated/packages/rs/src/lib.rs @@ -0,0 +1,2 @@ +pub mod v1_4; +pub mod v1_3; diff --git a/generated/packages/rs/src/v1_3.rs b/generated/packages/rs/src/v1_3.rs new file mode 100644 index 0000000..11e5e18 --- /dev/null +++ b/generated/packages/rs/src/v1_3.rs @@ -0,0 +1,662 @@ +extern crate serde; +extern crate serde_json; +extern crate derive_builder; + +use serde::{Serialize, Deserialize}; +use derive_builder::Builder; +use std::collections::HashMap; +#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)] +pub enum Openrpc { + #[serde(rename = "1.3.2")] + OneThreeTwo, + #[serde(rename = "1.3.1")] + OneThreeOne, + #[serde(rename = "1.3.0")] + OneThreeZero, + #[serde(rename = "1.2.6")] + OneTwoSix, + #[serde(rename = "1.2.5")] + OneTwoFive, + #[serde(rename = "1.2.4")] + OneTwoFour, + #[serde(rename = "1.2.3")] + OneTwoThree, + #[serde(rename = "1.2.2")] + OneTwoTwo, + #[serde(rename = "1.2.1")] + OneTwoOne, + #[serde(rename = "1.2.0")] + OneTwoZero, + #[serde(rename = "1.1.12")] + OneOneOneTwo, + #[serde(rename = "1.1.11")] + OneOneOneOne, + #[serde(rename = "1.1.10")] + OneOneOneZero, + #[serde(rename = "1.1.9")] + OneOneNine, + #[serde(rename = "1.1.8")] + OneOneEight, + #[serde(rename = "1.1.7")] + OneOneSeven, + #[serde(rename = "1.1.6")] + OneOneSix, + #[serde(rename = "1.1.5")] + OneOneFive, + #[serde(rename = "1.1.4")] + OneOneFour, + #[serde(rename = "1.1.3")] + OneOneThree, + #[serde(rename = "1.1.2")] + OneOneTwo, + #[serde(rename = "1.1.1")] + OneOneOne, + #[serde(rename = "1.1.0")] + OneOneZero, + #[serde(rename = "1.0.0")] + OneZeroZero, + #[serde(rename = "1.0.0-rc0")] + OneZeroZeroRcZero, + #[serde(rename = "1.0.0-rc1")] + OneZeroZeroRcOne, +} +pub type InfoObjectProperties = String; +pub type InfoObjectDescription = String; +pub type InfoObjectTermsOfService = String; +pub type InfoObjectVersion = String; +pub type ContactObjectName = String; +pub type ContactObjectEmail = String; +pub type ContactObjectUrl = String; +pub type SpecificationExtension = serde_json::Value; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct ContactObject { + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub email: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub url: Option, +} +pub type LicenseObjectName = String; +pub type LicenseObjectUrl = String; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct LicenseObject { + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub url: Option, +} +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct InfoObject { + pub title: InfoObjectProperties, + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "termsOfService", skip_serializing_if = "Option::is_none")] + pub terms_of_service: Option, + pub version: InfoObjectVersion, + #[serde(skip_serializing_if = "Option::is_none")] + pub contact: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub license: Option, +} +pub type ExternalDocumentationObjectDescription = String; +pub type ExternalDocumentationObjectUrl = String; +/// ExternalDocumentationObject +/// +/// information about external documentation +/// +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct ExternalDocumentationObject { + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + pub url: ExternalDocumentationObjectUrl, +} +pub type ServerObjectUrl = String; +pub type ServerObjectName = String; +pub type ServerObjectDescription = String; +pub type ServerObjectSummary = String; +pub type ServerObjectVariableDefault = String; +pub type ServerObjectVariableDescription = String; +pub type ServerObjectVariableEnumItem = String; +pub type ServerObjectVariableEnum = Vec; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct ServerObjectVariable { + #[serde(rename = "default")] + pub _default: ServerObjectVariableDefault, + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "enum", skip_serializing_if = "Option::is_none")] + pub _enum: Option, +} +pub type ServerObjectVariables = HashMap; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct ServerObject { + pub url: ServerObjectUrl, + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub summary: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub variables: Option, +} +type AlwaysFalse = serde_json::Value; +pub type Servers = Vec; +/// MethodObjectName +/// +/// The cannonical name for the method. The name MUST be unique within the methods array. +/// +pub type MethodObjectName = String; +/// MethodObjectDescription +/// +/// A verbose explanation of the method behavior. GitHub Flavored Markdown syntax MAY be used for rich text representation. +/// +pub type MethodObjectDescription = String; +/// MethodObjectSummary +/// +/// A short summary of what the method does. +/// +pub type MethodObjectSummary = String; +pub type TagObjectName = String; +pub type TagObjectDescription = String; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct TagObject { + pub name: TagObjectName, + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "externalDocs", skip_serializing_if = "Option::is_none")] + pub external_docs: Option, +} +pub type Ref = String; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct ReferenceObject { + #[serde(rename = "$ref")] + pub _ref: Ref, +} +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum TagOrReference { + TagObject(TagObject), + ReferenceObject(ReferenceObject), +} +pub type MethodObjectTags = Vec; +/// MethodObjectParamStructure +/// +/// Format the server expects the params. Defaults to 'either'. +/// +/// # Default +/// +/// either +/// +#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)] +pub enum MethodObjectParamStructure { + #[serde(rename = "by-position")] + ByPosition, + #[serde(rename = "by-name")] + ByName, + #[serde(rename = "either")] + Either, +} +pub type ContentDescriptorObjectName = String; +pub type ContentDescriptorObjectDescription = String; +pub type ContentDescriptorObjectSummary = String; +pub type Id = String; +pub type Schema = String; +pub type Comment = String; +pub type Title = String; +pub type Description = String; +type AlwaysTrue = serde_json::Value; +pub type ReadOnly = bool; +pub type Examples = Vec; +pub type MultipleOf = f64; +pub type Maximum = f64; +pub type ExclusiveMaximum = f64; +pub type Minimum = f64; +pub type ExclusiveMinimum = f64; +pub type NonNegativeInteger = i64; +pub type NonNegativeIntegerDefaultZero = i64; +pub type Pattern = String; +pub type SchemaArray = Vec; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum Items { + JSONSchema(Box), + SchemaArray(SchemaArray), +} +pub type UniqueItems = bool; +pub type StringDoaGddGA = String; +/// StringArray +/// +/// # Default +/// +/// [] +/// +pub type StringArray = Vec; +/// Definitions +/// +/// # Default +/// +/// {} +/// +pub type Definitions = HashMap; +/// Properties +/// +/// # Default +/// +/// {} +/// +pub type Properties = HashMap; +pub type PropertyNames = serde_json::Value; +/// PatternProperties +/// +/// # Default +/// +/// {} +/// +pub type PatternProperties = HashMap; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum DependenciesSet { + JSONSchema(Box), + StringArray(StringArray), +} +pub type Dependencies = HashMap; +pub type Enum = Vec; +#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)] +pub enum SimpleTypes { + #[serde(rename = "array")] + Array, + #[serde(rename = "boolean")] + Boolean, + #[serde(rename = "integer")] + Integer, + #[serde(rename = "null")] + Null, + #[serde(rename = "number")] + Number, + #[serde(rename = "object")] + Object, + #[serde(rename = "string")] + String, +} +pub type ArrayOfSimpleTypes = Vec; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum Type { + SimpleTypes(SimpleTypes), + ArrayOfSimpleTypes(ArrayOfSimpleTypes), +} +pub type Format = String; +pub type ContentMediaType = String; +pub type ContentEncoding = String; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct JSONSchemaObject { + #[serde(rename = "$id", skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option, + #[serde(rename = "$ref", skip_serializing_if = "Option::is_none")] + pub _ref: Option, + #[serde(rename = "$comment", skip_serializing_if = "Option::is_none")] + pub comment: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub title: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option<Description>, + #[serde(rename = "default", skip_serializing_if = "Option::is_none")] + pub _default: Option<AlwaysTrue>, + #[serde(rename = "readOnly", skip_serializing_if = "Option::is_none")] + pub read_only: Option<ReadOnly>, + #[serde(skip_serializing_if = "Option::is_none")] + pub examples: Option<Examples>, + #[serde(rename = "multipleOf", skip_serializing_if = "Option::is_none")] + pub multiple_of: Option<MultipleOf>, + #[serde(skip_serializing_if = "Option::is_none")] + pub maximum: Option<Maximum>, + #[serde(rename = "exclusiveMaximum", skip_serializing_if = "Option::is_none")] + pub exclusive_maximum: Option<ExclusiveMaximum>, + #[serde(skip_serializing_if = "Option::is_none")] + pub minimum: Option<Minimum>, + #[serde(rename = "exclusiveMinimum", skip_serializing_if = "Option::is_none")] + pub exclusive_minimum: Option<ExclusiveMinimum>, + #[serde(rename = "maxLength", skip_serializing_if = "Option::is_none")] + pub max_length: Option<NonNegativeInteger>, + #[serde(rename = "minLength", skip_serializing_if = "Option::is_none")] + pub min_length: Option<NonNegativeIntegerDefaultZero>, + #[serde(skip_serializing_if = "Option::is_none")] + pub pattern: Option<Pattern>, + #[serde(rename = "additionalItems", skip_serializing_if = "Option::is_none")] + pub additional_items: Option<Box<JSONSchema>>, + #[serde(skip_serializing_if = "Option::is_none")] + pub items: Option<Items>, + #[serde(rename = "maxItems", skip_serializing_if = "Option::is_none")] + pub max_items: Option<NonNegativeInteger>, + #[serde(rename = "minItems", skip_serializing_if = "Option::is_none")] + pub min_items: Option<NonNegativeIntegerDefaultZero>, + #[serde(rename = "uniqueItems", skip_serializing_if = "Option::is_none")] + pub unique_items: Option<UniqueItems>, + #[serde(skip_serializing_if = "Option::is_none")] + pub contains: Option<Box<JSONSchema>>, + #[serde(rename = "maxProperties", skip_serializing_if = "Option::is_none")] + pub max_properties: Option<NonNegativeInteger>, + #[serde(rename = "minProperties", skip_serializing_if = "Option::is_none")] + pub min_properties: Option<NonNegativeIntegerDefaultZero>, + #[serde(skip_serializing_if = "Option::is_none")] + pub required: Option<StringArray>, + #[serde(rename = "additionalProperties", skip_serializing_if = "Option::is_none")] + pub additional_properties: Option<Box<JSONSchema>>, + #[serde(skip_serializing_if = "Option::is_none")] + pub definitions: Option<Definitions>, + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option<Properties>, + #[serde(rename = "patternProperties", skip_serializing_if = "Option::is_none")] + pub pattern_properties: Option<PatternProperties>, + #[serde(skip_serializing_if = "Option::is_none")] + pub dependencies: Option<Dependencies>, + #[serde(rename = "propertyNames", skip_serializing_if = "Option::is_none")] + pub property_names: Option<Box<JSONSchema>>, + #[serde(rename = "const", skip_serializing_if = "Option::is_none")] + pub _const: Option<AlwaysTrue>, + #[serde(rename = "enum", skip_serializing_if = "Option::is_none")] + pub _enum: Option<Enum>, + #[serde(rename = "type", skip_serializing_if = "Option::is_none")] + pub _type: Option<Type>, + #[serde(skip_serializing_if = "Option::is_none")] + pub format: Option<Format>, + #[serde(rename = "contentMediaType", skip_serializing_if = "Option::is_none")] + pub content_media_type: Option<ContentMediaType>, + #[serde(rename = "contentEncoding", skip_serializing_if = "Option::is_none")] + pub content_encoding: Option<ContentEncoding>, + #[serde(rename = "if", skip_serializing_if = "Option::is_none")] + pub _if: Option<Box<JSONSchema>>, + #[serde(skip_serializing_if = "Option::is_none")] + pub then: Option<Box<JSONSchema>>, + #[serde(rename = "else", skip_serializing_if = "Option::is_none")] + pub _else: Option<Box<JSONSchema>>, + #[serde(rename = "allOf", skip_serializing_if = "Option::is_none")] + pub all_of: Option<SchemaArray>, + #[serde(rename = "anyOf", skip_serializing_if = "Option::is_none")] + pub any_of: Option<SchemaArray>, + #[serde(rename = "oneOf", skip_serializing_if = "Option::is_none")] + pub one_of: Option<SchemaArray>, + #[serde(skip_serializing_if = "Option::is_none")] + pub not: Option<Box<JSONSchema>>, +} +/// JSONSchemaBoolean +/// +/// Always valid if true. Never valid if false. Is constant. +/// +pub type JSONSchemaBoolean = bool; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum JSONSchema { + JSONSchemaObject(JSONSchemaObject), + JSONSchemaBoolean(JSONSchemaBoolean), +} +pub type ContentDescriptorObjectRequired = bool; +pub type ContentDescriptorObjectDeprecated = bool; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct ContentDescriptorObject { + pub name: ContentDescriptorObjectName, + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option<ContentDescriptorObjectDescription>, + #[serde(skip_serializing_if = "Option::is_none")] + pub summary: Option<ContentDescriptorObjectSummary>, + pub schema: Box<JSONSchema>, + #[serde(skip_serializing_if = "Option::is_none")] + pub required: Option<ContentDescriptorObjectRequired>, + #[serde(skip_serializing_if = "Option::is_none")] + pub deprecated: Option<ContentDescriptorObjectDeprecated>, +} +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum ContentDescriptorOrReference { + ContentDescriptorObject(ContentDescriptorObject), + ReferenceObject(ReferenceObject), +} +pub type MethodObjectParams = Vec<ContentDescriptorOrReference>; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum MethodObjectResult { + ContentDescriptorObject(ContentDescriptorObject), + ReferenceObject(ReferenceObject), +} +/// ErrorObjectCode +/// +/// A Number that indicates the error type that occurred. This MUST be an integer. The error codes from and including -32768 to -32000 are reserved for pre-defined errors. These pre-defined errors SHOULD be assumed to be returned from any JSON-RPC api. +/// +pub type ErrorObjectCode = i64; +/// ErrorObjectMessage +/// +/// A String providing a short description of the error. The message SHOULD be limited to a concise single sentence. +/// +pub type ErrorObjectMessage = String; +/// ErrorObjectData +/// +/// A Primitive or Structured value that contains additional information about the error. This may be omitted. The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.). +/// +pub type ErrorObjectData = serde_json::Value; +/// ErrorObject +/// +/// Defines an application level error. +/// +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct ErrorObject { + pub code: ErrorObjectCode, + pub message: ErrorObjectMessage, + #[serde(skip_serializing_if = "Option::is_none")] + pub data: Option<ErrorObjectData>, +} +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum ErrorOrReference { + ErrorObject(ErrorObject), + ReferenceObject(ReferenceObject), +} +/// MethodObjectErrors +/// +/// Defines an application level error. +/// +pub type MethodObjectErrors = Vec<ErrorOrReference>; +pub type LinkObjectName = String; +pub type LinkObjectSummary = String; +pub type LinkObjectMethod = String; +pub type LinkObjectDescription = String; +pub type LinkObjectParams = serde_json::Value; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct LinkObjectServer { + pub url: ServerObjectUrl, + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option<ServerObjectName>, + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option<ServerObjectDescription>, + #[serde(skip_serializing_if = "Option::is_none")] + pub summary: Option<ServerObjectSummary>, + #[serde(skip_serializing_if = "Option::is_none")] + pub variables: Option<ServerObjectVariables>, +} +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct LinkObject { + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option<LinkObjectName>, + #[serde(skip_serializing_if = "Option::is_none")] + pub summary: Option<LinkObjectSummary>, + #[serde(skip_serializing_if = "Option::is_none")] + pub method: Option<LinkObjectMethod>, + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option<LinkObjectDescription>, + #[serde(skip_serializing_if = "Option::is_none")] + pub params: Option<LinkObjectParams>, + #[serde(skip_serializing_if = "Option::is_none")] + pub server: Option<LinkObjectServer>, +} +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum LinkOrReference { + LinkObject(LinkObject), + ReferenceObject(ReferenceObject), +} +pub type MethodObjectLinks = Vec<LinkOrReference>; +pub type ExamplePairingObjectName = String; +pub type ExamplePairingObjectDescription = String; +pub type ExampleObjectSummary = String; +pub type ExampleObjectValue = serde_json::Value; +pub type ExampleObjectDescription = String; +pub type ExampleObjectName = String; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct ExampleObject { + #[serde(skip_serializing_if = "Option::is_none")] + pub summary: Option<ExampleObjectSummary>, + pub value: ExampleObjectValue, + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option<ExampleObjectDescription>, + pub name: ExampleObjectName, +} +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum ExampleOrReference { + ExampleObject(ExampleObject), + ReferenceObject(ReferenceObject), +} +pub type ExamplePairingObjectParams = Vec<ExampleOrReference>; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum ExamplePairingObjectResult { + ExampleObject(ExampleObject), + ReferenceObject(ReferenceObject), +} +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct ExamplePairingObject { + pub name: ExamplePairingObjectName, + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option<ExamplePairingObjectDescription>, + pub params: ExamplePairingObjectParams, + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<ExamplePairingObjectResult>, +} +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum ExamplePairingOrReference { + ExamplePairingObject(ExamplePairingObject), + ReferenceObject(ReferenceObject), +} +pub type MethodObjectExamples = Vec<ExamplePairingOrReference>; +pub type MethodObjectDeprecated = bool; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct MethodObject { + pub name: MethodObjectName, + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option<MethodObjectDescription>, + #[serde(skip_serializing_if = "Option::is_none")] + pub summary: Option<MethodObjectSummary>, + #[serde(skip_serializing_if = "Option::is_none")] + pub servers: Option<Servers>, + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option<MethodObjectTags>, + #[serde(rename = "paramStructure", skip_serializing_if = "Option::is_none")] + pub param_structure: Option<MethodObjectParamStructure>, + pub params: MethodObjectParams, + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<MethodObjectResult>, + #[serde(skip_serializing_if = "Option::is_none")] + pub errors: Option<MethodObjectErrors>, + #[serde(skip_serializing_if = "Option::is_none")] + pub links: Option<MethodObjectLinks>, + #[serde(skip_serializing_if = "Option::is_none")] + pub examples: Option<MethodObjectExamples>, + #[serde(skip_serializing_if = "Option::is_none")] + pub deprecated: Option<MethodObjectDeprecated>, + #[serde(rename = "externalDocs", skip_serializing_if = "Option::is_none")] + pub external_docs: Option<ExternalDocumentationObject>, +} +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum MethodOrReference { + MethodObject(MethodObject), + ReferenceObject(ReferenceObject), +} +pub type Methods = Vec<MethodOrReference>; +pub type SchemaComponents = HashMap<String, serde_json::Value>; +pub type LinkComponents = HashMap<String, serde_json::Value>; +pub type ErrorComponents = HashMap<String, serde_json::Value>; +pub type ExampleComponents = HashMap<String, serde_json::Value>; +pub type ExamplePairingComponents = HashMap<String, serde_json::Value>; +pub type ContentDescriptorComponents = HashMap<String, serde_json::Value>; +pub type TagComponents = HashMap<String, serde_json::Value>; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct Components { + #[serde(skip_serializing_if = "Option::is_none")] + pub schemas: Option<SchemaComponents>, + #[serde(skip_serializing_if = "Option::is_none")] + pub links: Option<LinkComponents>, + #[serde(skip_serializing_if = "Option::is_none")] + pub errors: Option<ErrorComponents>, + #[serde(skip_serializing_if = "Option::is_none")] + pub examples: Option<ExampleComponents>, + #[serde(rename = "examplePairings", skip_serializing_if = "Option::is_none")] + pub example_pairings: Option<ExamplePairingComponents>, + #[serde(rename = "contentDescriptors", skip_serializing_if = "Option::is_none")] + pub content_descriptors: Option<ContentDescriptorComponents>, + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option<TagComponents>, +} +/// MetaSchema +/// +/// JSON Schema URI (used by some editors) +/// +/// # Default +/// +/// https://meta.open-rpc.org/ +/// +pub type MetaSchema = String; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct OpenrpcDocument { + pub openrpc: Openrpc, + pub info: InfoObject, + #[serde(rename = "externalDocs", skip_serializing_if = "Option::is_none")] + pub external_docs: Option<ExternalDocumentationObject>, + #[serde(skip_serializing_if = "Option::is_none")] + pub servers: Option<Servers>, + pub methods: Methods, + #[serde(skip_serializing_if = "Option::is_none")] + pub components: Option<Components>, + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option<MetaSchema>, +} \ No newline at end of file diff --git a/generated/packages/rs/src/v1_4.rs b/generated/packages/rs/src/v1_4.rs new file mode 100644 index 0000000..80e4187 --- /dev/null +++ b/generated/packages/rs/src/v1_4.rs @@ -0,0 +1,856 @@ +extern crate serde; +extern crate serde_json; +extern crate derive_builder; + +use serde::{Serialize, Deserialize}; +use derive_builder::Builder; +use std::collections::HashMap; +/// Openrpc +/// +/// This string MUST be the [semantic version number](https://semver.org/spec/v2.0.0.html) of the [OpenRPC Specification version](#versions) that the OpenRPC document uses. The `openrpc` field SHOULD be used by tooling specifications and clients to interpret the OpenRPC document. This is *not* related to the API [`info.version`](#info-version) string. +/// +pub type Openrpc = String; +/// InfoObjectTitle +/// +/// The title of the application. +/// +pub type InfoObjectTitle = String; +/// InfoObjectDescription +/// +/// A verbose description of the application. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +/// +pub type InfoObjectDescription = String; +/// InfoObjectTermsOfService +/// +/// A URL to the Terms of Service for the API. MUST be in the format of a URL. +/// +pub type InfoObjectTermsOfService = String; +/// InfoObjectVersion +/// +/// The version of the OpenRPC document (which is distinct from the [OpenRPC Specification version](#openrpc-document-openrpc) or the API implementation version). +/// +pub type InfoObjectVersion = String; +/// ContactObjectName +/// +/// The identifying name of the contact person/organization. +/// +pub type ContactObjectName = String; +/// ContactObjectEmail +/// +/// The email address of the contact person/organization. MUST be in the format of an email address. +/// +pub type ContactObjectEmail = String; +/// ContactObjectUrl +/// +/// The URL pointing to the contact information. MUST be in the format of a URL. +/// +pub type ContactObjectUrl = String; +/// SpecificationExtension +/// +/// This object MAY be extended with [Specification Extensions](#specification-extensions). +/// +pub type SpecificationExtension = serde_json::Value; +/// ContactObject +/// +/// Contact information for the exposed API. +/// +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct ContactObject { + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option<ContactObjectName>, + #[serde(skip_serializing_if = "Option::is_none")] + pub email: Option<ContactObjectEmail>, + #[serde(skip_serializing_if = "Option::is_none")] + pub url: Option<ContactObjectUrl>, +} +/// LicenseObjectName +/// +/// The license name used for the API. +/// +pub type LicenseObjectName = String; +/// LicenseObjectUrl +/// +/// A URL to the license used for the API. MUST be in the format of a URL. +/// +pub type LicenseObjectUrl = String; +/// LicenseObject +/// +/// License information for the exposed API. +/// +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct LicenseObject { + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option<LicenseObjectName>, + #[serde(skip_serializing_if = "Option::is_none")] + pub url: Option<LicenseObjectUrl>, +} +/// InfoObject +/// +/// The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience. +/// +pub type InfoObject = serde_json::Value; +/// ExternalDocumentationObjectDescription +/// +/// A verbose explanation of the documentation. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +/// +pub type ExternalDocumentationObjectDescription = String; +/// ExternalDocumentationObjectUrl +/// +/// The URL for the target documentation. Value MUST be in the format of a URL. +/// +pub type ExternalDocumentationObjectUrl = String; +/// ExternalDocumentationObject +/// +/// Additional external documentation for this tag. +/// +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct ExternalDocumentationObject { + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option<ExternalDocumentationObjectDescription>, + pub url: ExternalDocumentationObjectUrl, +} +/// ServerObjectUrl +/// +/// A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenRPC document is being served. [Server Variables](#server-variables) are passed into the [Runtime Expression](#runtime-expression) to produce a server URL. +/// +pub type ServerObjectUrl = String; +/// ServerObjectName +/// +/// An optional string describing the name of the server. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +/// +pub type ServerObjectName = String; +/// ServerObjectDescription +/// +/// An optional string describing the host designated by the URL. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +/// +pub type ServerObjectDescription = String; +/// ServerObjectSummary +/// +/// A short summary of what the server is. +/// +pub type ServerObjectSummary = String; +/// ServerObjectVariableDefault +/// +/// The default value to use for substitution, which SHALL be sent if an alternate value is _not_ supplied. Note this behavior is different than the [Schema Object's](#schema-object) treatment of default values, because in those cases parameter values are optional. +/// +pub type ServerObjectVariableDefault = String; +/// ServerObjectVariableDescription +/// +/// An optional description for the server variable. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +/// +pub type ServerObjectVariableDescription = String; +/// ServerObjectVariableEnumItem +/// +/// An enumeration of string values to be used if the substitution options are from a limited set. +/// +pub type ServerObjectVariableEnumItem = String; +/// ServerObjectVariableEnum +/// +/// An enumeration of string values to be used if the substitution options are from a limited set. +/// +pub type ServerObjectVariableEnum = Vec<ServerObjectVariableEnumItem>; +/// ServerObjectVariable +/// +/// An object representing a Server Variable for server URL template substitution. +/// +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct ServerObjectVariable { + #[serde(rename = "default")] + pub _default: ServerObjectVariableDefault, + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option<ServerObjectVariableDescription>, + #[serde(rename = "enum", skip_serializing_if = "Option::is_none")] + pub _enum: Option<ServerObjectVariableEnum>, +} +/// ServerObjectVariables +/// +/// A map between a variable name and its value. The value is passed into the [Runtime Expression](#runtime-expression) to produce a server URL. +/// +pub type ServerObjectVariables = HashMap<String, serde_json::Value>; +/// ServerObject +/// +/// A object representing a Server +/// +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct ServerObject { + pub url: ServerObjectUrl, + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option<ServerObjectName>, + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option<ServerObjectDescription>, + #[serde(skip_serializing_if = "Option::is_none")] + pub summary: Option<ServerObjectSummary>, + #[serde(skip_serializing_if = "Option::is_none")] + pub variables: Option<ServerObjectVariables>, +} +type AlwaysFalse = serde_json::Value; +/// Servers +/// +/// An array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](#server-object) with a [url](#server-url) value of `localhost`. +/// +pub type Servers = Vec<ServerObject>; +/// MethodObjectName +/// +/// The cannonical name for the method. The name MUST be unique within the methods array. +/// +pub type MethodObjectName = String; +/// MethodObjectDescription +/// +/// A verbose explanation of the method behavior. GitHub Flavored Markdown syntax MAY be used for rich text representation. +/// +pub type MethodObjectDescription = String; +/// MethodObjectSummary +/// +/// A short summary of what the method does. +/// +pub type MethodObjectSummary = String; +/// TagObjectName +/// +/// The name of the tag. +/// +pub type TagObjectName = String; +/// TagObjectDescription +/// +/// A verbose explanation for the tag. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +/// +pub type TagObjectDescription = String; +/// TagObject +/// +/// Adds metadata to a single tag that is used by the [Method Object](#method-object). It is not mandatory to have a Tag Object per tag defined in the Method Object instances. +/// +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct TagObject { + pub name: TagObjectName, + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option<TagObjectDescription>, + #[serde(rename = "externalDocs", skip_serializing_if = "Option::is_none")] + pub external_docs: Option<ExternalDocumentationObject>, +} +pub type Ref = String; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct ReferenceObject { + #[serde(rename = "$ref")] + pub _ref: Ref, +} +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum TagOrReference { + TagObject(TagObject), + ReferenceObject(ReferenceObject), +} +/// MethodObjectTags +/// +/// A list of tags for API documentation control. Tags can be used for logical grouping of methods by resources or any other qualifier. +/// +pub type MethodObjectTags = Vec<TagOrReference>; +/// MethodObjectParamStructure +/// +/// Format the server expects the params. Defaults to 'either'. +/// +/// # Default +/// +/// either +/// +#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)] +pub enum MethodObjectParamStructure { + #[serde(rename = "by-position")] + ByPosition, + #[serde(rename = "by-name")] + ByName, + #[serde(rename = "either")] + Either, +} +/// ContentDescriptorObjectName +/// +/// Name of the content that is being described. If the content described is a method parameter assignable [`by-name`](#method-param-structure), this field SHALL define the parameter's key (ie name). +/// +pub type ContentDescriptorObjectName = String; +/// ContentDescriptorObjectDescription +/// +/// A verbose explanation of the content descriptor behavior. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +/// +pub type ContentDescriptorObjectDescription = String; +/// ContentDescriptorObjectSummary +/// +/// A short summary of the content that is being described. +/// +pub type ContentDescriptorObjectSummary = String; +pub type Id = String; +pub type Schema = String; +pub type Comment = String; +pub type Title = String; +pub type Description = String; +type AlwaysTrue = serde_json::Value; +pub type ReadOnly = bool; +pub type Examples = Vec<AlwaysTrue>; +pub type MultipleOf = f64; +pub type Maximum = f64; +pub type ExclusiveMaximum = f64; +pub type Minimum = f64; +pub type ExclusiveMinimum = f64; +pub type NonNegativeInteger = i64; +pub type NonNegativeIntegerDefaultZero = i64; +pub type Pattern = String; +/// JSONSchemaBoolean +/// +/// Always valid if true. Never valid if false. Is constant. +/// +pub type JSONSchemaBoolean = bool; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum JSONSchema { + JSONSchemaObject(Box<JSONSchemaObject>), + JSONSchemaBoolean(JSONSchemaBoolean), +} +pub type SchemaArray = Vec<JSONSchema>; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum Items { + JSONSchema(JSONSchema), + SchemaArray(SchemaArray), +} +pub type UniqueItems = bool; +pub type StringDoaGddGA = String; +/// StringArray +/// +/// # Default +/// +/// [] +/// +pub type StringArray = Vec<StringDoaGddGA>; +/// Definitions +/// +/// # Default +/// +/// {} +/// +pub type Definitions = HashMap<String, JSONSchema>; +/// Properties +/// +/// # Default +/// +/// {} +/// +pub type Properties = HashMap<String, JSONSchema>; +pub type PropertyNames = serde_json::Value; +/// PatternProperties +/// +/// # Default +/// +/// {} +/// +pub type PatternProperties = HashMap<String, JSONSchema>; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum DependenciesSet { + JSONSchema(JSONSchema), + StringArray(StringArray), +} +pub type Dependencies = HashMap<String, DependenciesSet>; +pub type Enum = Vec<AlwaysTrue>; +#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)] +pub enum SimpleTypes { + #[serde(rename = "array")] + Array, + #[serde(rename = "boolean")] + Boolean, + #[serde(rename = "integer")] + Integer, + #[serde(rename = "null")] + Null, + #[serde(rename = "number")] + Number, + #[serde(rename = "object")] + Object, + #[serde(rename = "string")] + String, +} +pub type ArrayOfSimpleTypes = Vec<SimpleTypes>; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum Type { + SimpleTypes(SimpleTypes), + ArrayOfSimpleTypes(ArrayOfSimpleTypes), +} +pub type Format = String; +pub type ContentMediaType = String; +pub type ContentEncoding = String; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct JSONSchemaObject { + #[serde(rename = "$id", skip_serializing_if = "Option::is_none")] + pub id: Option<Id>, + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option<Schema>, + #[serde(rename = "$ref", skip_serializing_if = "Option::is_none")] + pub _ref: Option<Ref>, + #[serde(rename = "$comment", skip_serializing_if = "Option::is_none")] + pub comment: Option<Comment>, + #[serde(skip_serializing_if = "Option::is_none")] + pub title: Option<Title>, + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option<Description>, + #[serde(rename = "default", skip_serializing_if = "Option::is_none")] + pub _default: Option<AlwaysTrue>, + #[serde(rename = "readOnly", skip_serializing_if = "Option::is_none")] + pub read_only: Option<ReadOnly>, + #[serde(skip_serializing_if = "Option::is_none")] + pub examples: Option<Examples>, + #[serde(rename = "multipleOf", skip_serializing_if = "Option::is_none")] + pub multiple_of: Option<MultipleOf>, + #[serde(skip_serializing_if = "Option::is_none")] + pub maximum: Option<Maximum>, + #[serde(rename = "exclusiveMaximum", skip_serializing_if = "Option::is_none")] + pub exclusive_maximum: Option<ExclusiveMaximum>, + #[serde(skip_serializing_if = "Option::is_none")] + pub minimum: Option<Minimum>, + #[serde(rename = "exclusiveMinimum", skip_serializing_if = "Option::is_none")] + pub exclusive_minimum: Option<ExclusiveMinimum>, + #[serde(rename = "maxLength", skip_serializing_if = "Option::is_none")] + pub max_length: Option<NonNegativeInteger>, + #[serde(rename = "minLength", skip_serializing_if = "Option::is_none")] + pub min_length: Option<NonNegativeIntegerDefaultZero>, + #[serde(skip_serializing_if = "Option::is_none")] + pub pattern: Option<Pattern>, + #[serde(rename = "additionalItems", skip_serializing_if = "Option::is_none")] + pub additional_items: Option<JSONSchema>, + #[serde(skip_serializing_if = "Option::is_none")] + pub items: Option<Items>, + #[serde(rename = "maxItems", skip_serializing_if = "Option::is_none")] + pub max_items: Option<NonNegativeInteger>, + #[serde(rename = "minItems", skip_serializing_if = "Option::is_none")] + pub min_items: Option<NonNegativeIntegerDefaultZero>, + #[serde(rename = "uniqueItems", skip_serializing_if = "Option::is_none")] + pub unique_items: Option<UniqueItems>, + #[serde(skip_serializing_if = "Option::is_none")] + pub contains: Option<JSONSchema>, + #[serde(rename = "maxProperties", skip_serializing_if = "Option::is_none")] + pub max_properties: Option<NonNegativeInteger>, + #[serde(rename = "minProperties", skip_serializing_if = "Option::is_none")] + pub min_properties: Option<NonNegativeIntegerDefaultZero>, + #[serde(skip_serializing_if = "Option::is_none")] + pub required: Option<StringArray>, + #[serde(rename = "additionalProperties", skip_serializing_if = "Option::is_none")] + pub additional_properties: Option<JSONSchema>, + #[serde(skip_serializing_if = "Option::is_none")] + pub definitions: Option<Definitions>, + #[serde(skip_serializing_if = "Option::is_none")] + pub properties: Option<Properties>, + #[serde(rename = "patternProperties", skip_serializing_if = "Option::is_none")] + pub pattern_properties: Option<PatternProperties>, + #[serde(skip_serializing_if = "Option::is_none")] + pub dependencies: Option<Dependencies>, + #[serde(rename = "propertyNames", skip_serializing_if = "Option::is_none")] + pub property_names: Option<JSONSchema>, + #[serde(rename = "const", skip_serializing_if = "Option::is_none")] + pub _const: Option<AlwaysTrue>, + #[serde(rename = "enum", skip_serializing_if = "Option::is_none")] + pub _enum: Option<Enum>, + #[serde(rename = "type", skip_serializing_if = "Option::is_none")] + pub _type: Option<Type>, + #[serde(skip_serializing_if = "Option::is_none")] + pub format: Option<Format>, + #[serde(rename = "contentMediaType", skip_serializing_if = "Option::is_none")] + pub content_media_type: Option<ContentMediaType>, + #[serde(rename = "contentEncoding", skip_serializing_if = "Option::is_none")] + pub content_encoding: Option<ContentEncoding>, + #[serde(rename = "if", skip_serializing_if = "Option::is_none")] + pub _if: Option<JSONSchema>, + #[serde(skip_serializing_if = "Option::is_none")] + pub then: Option<JSONSchema>, + #[serde(rename = "else", skip_serializing_if = "Option::is_none")] + pub _else: Option<JSONSchema>, + #[serde(rename = "allOf", skip_serializing_if = "Option::is_none")] + pub all_of: Option<SchemaArray>, + #[serde(rename = "anyOf", skip_serializing_if = "Option::is_none")] + pub any_of: Option<SchemaArray>, + #[serde(rename = "oneOf", skip_serializing_if = "Option::is_none")] + pub one_of: Option<SchemaArray>, + #[serde(skip_serializing_if = "Option::is_none")] + pub not: Option<JSONSchema>, +} +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum ContentDescriptorObjectSchema { + JSONSchemaObject(Box<JSONSchemaObject>), + JSONSchemaBoolean(JSONSchemaBoolean), +} +/// ContentDescriptorObjectRequired +/// +/// Determines if the content is a required field. Default value is `false`. +/// +pub type ContentDescriptorObjectRequired = bool; +/// ContentDescriptorObjectDeprecated +/// +/// Specifies that the content is deprecated and SHOULD be transitioned out of usage. Default value is `false`. +/// +pub type ContentDescriptorObjectDeprecated = bool; +/// ContentDescriptorObject +/// +/// Content Descriptors are objects that do just as they suggest - describe content. They are reusable ways of describing either parameters or result. They MUST have a schema. +/// +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct ContentDescriptorObject { + pub name: ContentDescriptorObjectName, + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option<ContentDescriptorObjectDescription>, + #[serde(skip_serializing_if = "Option::is_none")] + pub summary: Option<ContentDescriptorObjectSummary>, + pub schema: ContentDescriptorObjectSchema, + #[serde(skip_serializing_if = "Option::is_none")] + pub required: Option<ContentDescriptorObjectRequired>, + #[serde(skip_serializing_if = "Option::is_none")] + pub deprecated: Option<ContentDescriptorObjectDeprecated>, +} +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum ContentDescriptorOrReference { + ContentDescriptorObject(ContentDescriptorObject), + ReferenceObject(ReferenceObject), +} +/// MethodObjectParams +/// +/// A list of parameters that are applicable for this method. The list MUST NOT include duplicated parameters and therefore require [name](#content-descriptor-name) to be unique. The list can use the [Reference Object](#reference-object) to link to parameters that are defined by the [Content Descriptor Object](#content-descriptor-object). All optional params (content descriptor objects with "required": false) MUST be positioned after all required params in the list. +/// +pub type MethodObjectParams = Vec<ContentDescriptorOrReference>; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum MethodObjectResult { + ContentDescriptorObject(ContentDescriptorObject), + ReferenceObject(ReferenceObject), +} +/// ErrorObjectCode +/// +/// A Number that indicates the error type that occurred. This MUST be an integer. The error codes from and including -32768 to -32000 are reserved for pre-defined errors. These pre-defined errors SHOULD be assumed to be returned from any JSON-RPC api. +/// +pub type ErrorObjectCode = i64; +/// ErrorObjectMessage +/// +/// A String providing a short description of the error. The message SHOULD be limited to a concise single sentence. +/// +pub type ErrorObjectMessage = String; +/// ErrorObjectData +/// +/// A Primitive or Structured value that contains additional information about the error. This may be omitted. The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.). +/// +pub type ErrorObjectData = serde_json::Value; +/// ErrorObject +/// +/// Defines an application level error. +/// +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct ErrorObject { + pub code: ErrorObjectCode, + pub message: ErrorObjectMessage, + #[serde(skip_serializing_if = "Option::is_none")] + pub data: Option<ErrorObjectData>, +} +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum ErrorOrReference { + ErrorObject(ErrorObject), + ReferenceObject(ReferenceObject), +} +/// MethodObjectErrors +/// +/// A list of custom application defined errors that MAY be returned. The Errors MUST have unique error codes. +/// +pub type MethodObjectErrors = Vec<ErrorOrReference>; +/// LinkObjectName +/// +/// Cannonical name of the link. +/// +pub type LinkObjectName = serde_json::Value; +/// LinkObjectSummary +/// +/// Short description for the link. +/// +pub type LinkObjectSummary = String; +/// LinkObjectMethod +/// +/// The name of an existing, resolvable OpenRPC method, as defined with a unique `method`. This field MUST resolve to a unique [Method Object](#method-object). As opposed to Open Api, Relative `method` values ARE NOT permitted. +/// +pub type LinkObjectMethod = String; +/// LinkObjectDescription +/// +/// A description of the link. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +/// +pub type LinkObjectDescription = String; +/// LinkObjectParams +/// +/// A map representing parameters to pass to a method as specified with `method`. The key is the parameter name to be used, whereas the value can be a constant or a [runtime expression](#runtime-expression) to be evaluated and passed to the linked method. +/// +pub type LinkObjectParams = serde_json::Value; +/// LinkObjectServer +/// +/// A server object to be used by the target method. +/// +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct LinkObjectServer { + pub url: ServerObjectUrl, + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option<ServerObjectName>, + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option<ServerObjectDescription>, + #[serde(skip_serializing_if = "Option::is_none")] + pub summary: Option<ServerObjectSummary>, + #[serde(skip_serializing_if = "Option::is_none")] + pub variables: Option<ServerObjectVariables>, +} +/// LinkObject +/// +/// A object representing a Link +/// +pub type LinkObject = serde_json::Value; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum LinkOrReference { + LinkObject(LinkObject), + ReferenceObject(ReferenceObject), +} +/// MethodObjectLinks +/// +/// A list of possible links from this method call. +/// +pub type MethodObjectLinks = Vec<LinkOrReference>; +/// ExamplePairingObjectName +/// +/// Name for the example pairing. +/// +pub type ExamplePairingObjectName = String; +/// ExamplePairingObjectDescription +/// +/// A verbose explanation of the example pairing. +/// +pub type ExamplePairingObjectDescription = String; +/// ExampleObjectSummary +/// +/// Short description for the example. +/// +pub type ExampleObjectSummary = String; +/// ExampleObjectValue +/// +/// Embedded literal example. The `value` field and `externalValue` field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON, use a string value to contain the example, escaping where necessary. +/// +pub type ExampleObjectValue = serde_json::Value; +/// ExampleObjectDescription +/// +/// A verbose explanation of the example. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. +/// +pub type ExampleObjectDescription = String; +/// ExampleObjectName +/// +/// Cannonical name of the example. +/// +pub type ExampleObjectName = String; +/// ExampleObject +/// +/// The Example object is an object that defines an example that is intended to match the `schema` of a given [Content Descriptor](#content-descriptor-object). +/// +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct ExampleObject { + #[serde(skip_serializing_if = "Option::is_none")] + pub summary: Option<ExampleObjectSummary>, + pub value: ExampleObjectValue, + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option<ExampleObjectDescription>, + pub name: ExampleObjectName, +} +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum ExampleOrReference { + ExampleObject(ExampleObject), + ReferenceObject(ReferenceObject), +} +/// ExamplePairingObjectParams +/// +/// Example parameters. +/// +pub type ExamplePairingObjectParams = Vec<ExampleOrReference>; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum ExamplePairingObjectResult { + ExampleObject(ExampleObject), + ReferenceObject(ReferenceObject), +} +/// ExamplePairingObject +/// +/// The Example Pairing object consists of a set of example params and result. The result is what you can expect from the JSON-RPC service given the exact params. +/// +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct ExamplePairingObject { + pub name: ExamplePairingObjectName, + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option<ExamplePairingObjectDescription>, + pub params: ExamplePairingObjectParams, + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<ExamplePairingObjectResult>, +} +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum ExamplePairingOrReference { + ExamplePairingObject(ExamplePairingObject), + ReferenceObject(ReferenceObject), +} +/// MethodObjectExamples +/// +/// Array of [Example Pairing Objects](#example-pairing-object) where each example includes a valid params-to-result [Content Descriptor](#content-descriptor-object) pairing. +/// +pub type MethodObjectExamples = Vec<ExamplePairingOrReference>; +/// MethodObjectDeprecated +/// +/// Declares this method to be deprecated. Consumers SHOULD refrain from usage of the declared method. Default value is `false`. +/// +pub type MethodObjectDeprecated = bool; +/// MethodObject +/// +/// Describes the interface for the given method name. The method name is used as the `method` field of the JSON-RPC body. It therefore MUST be unique. +/// +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct MethodObject { + pub name: MethodObjectName, + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option<MethodObjectDescription>, + #[serde(skip_serializing_if = "Option::is_none")] + pub summary: Option<MethodObjectSummary>, + #[serde(skip_serializing_if = "Option::is_none")] + pub servers: Option<Servers>, + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option<MethodObjectTags>, + #[serde(rename = "paramStructure", skip_serializing_if = "Option::is_none")] + pub param_structure: Option<MethodObjectParamStructure>, + pub params: MethodObjectParams, + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option<MethodObjectResult>, + #[serde(skip_serializing_if = "Option::is_none")] + pub errors: Option<MethodObjectErrors>, + #[serde(skip_serializing_if = "Option::is_none")] + pub links: Option<MethodObjectLinks>, + #[serde(skip_serializing_if = "Option::is_none")] + pub examples: Option<MethodObjectExamples>, + #[serde(skip_serializing_if = "Option::is_none")] + pub deprecated: Option<MethodObjectDeprecated>, + #[serde(rename = "externalDocs", skip_serializing_if = "Option::is_none")] + pub external_docs: Option<ExternalDocumentationObject>, +} +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[serde(untagged)] +pub enum MethodOrReference { + MethodObject(MethodObject), + ReferenceObject(ReferenceObject), +} +/// Methods +/// +/// The available methods for the API. While it is required, the array may be empty (to handle security filtering, for example). +/// +pub type Methods = Vec<MethodOrReference>; +/// SchemaComponents +/// +/// An object to hold reusable [Schema Objects](#schema-object). +/// +pub type SchemaComponents = HashMap<String, serde_json::Value>; +/// LinkComponents +/// +/// An object to hold reusable [Link Objects](#link-object). +/// +pub type LinkComponents = HashMap<String, serde_json::Value>; +/// ErrorComponents +/// +/// An object to hold reusable [Error Objects](#error-object). +/// +pub type ErrorComponents = HashMap<String, serde_json::Value>; +/// ExampleComponents +/// +/// An object to hold reusable [Example Objects](#example-object). +/// +pub type ExampleComponents = HashMap<String, serde_json::Value>; +/// ExamplePairingComponents +/// +/// An object to hold reusable [Example Pairing Objects](#example-pairing-object). +/// +pub type ExamplePairingComponents = HashMap<String, serde_json::Value>; +/// ContentDescriptorComponents +/// +/// An object to hold reusable [Content Descriptor Objects](#content-descriptor-object). +/// +pub type ContentDescriptorComponents = HashMap<String, serde_json::Value>; +/// TagComponents +/// +/// An object to hold reusable [Tag Objects](#tag-object). +/// +pub type TagComponents = HashMap<String, serde_json::Value>; +/// Components +/// +/// Holds a set of reusable objects for different aspects of the OpenRPC. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object. +/// +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct Components { + #[serde(skip_serializing_if = "Option::is_none")] + pub schemas: Option<SchemaComponents>, + #[serde(skip_serializing_if = "Option::is_none")] + pub links: Option<LinkComponents>, + #[serde(skip_serializing_if = "Option::is_none")] + pub errors: Option<ErrorComponents>, + #[serde(skip_serializing_if = "Option::is_none")] + pub examples: Option<ExampleComponents>, + #[serde(rename = "examplePairings", skip_serializing_if = "Option::is_none")] + pub example_pairings: Option<ExamplePairingComponents>, + #[serde(rename = "contentDescriptors", skip_serializing_if = "Option::is_none")] + pub content_descriptors: Option<ContentDescriptorComponents>, + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option<TagComponents>, +} +/// MetaSchema +/// +/// JSON Schema URI (used by some editors) +/// +/// # Default +/// +/// https://meta.open-rpc.org/ +/// +pub type MetaSchema = String; +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Builder, Default)] +#[builder(setter(strip_option), default)] +#[serde(default)] +pub struct OpenrpcDocument { + pub openrpc: Openrpc, + pub info: InfoObject, + #[serde(rename = "externalDocs", skip_serializing_if = "Option::is_none")] + pub external_docs: Option<ExternalDocumentationObject>, + #[serde(skip_serializing_if = "Option::is_none")] + pub servers: Option<Servers>, + pub methods: Methods, + #[serde(skip_serializing_if = "Option::is_none")] + pub components: Option<Components>, + #[serde(rename = "$schema", skip_serializing_if = "Option::is_none")] + pub schema: Option<MetaSchema>, +} \ No newline at end of file diff --git a/generated/packages/ts/1_3/index.d.ts b/generated/packages/ts/1_3/index.d.ts new file mode 100644 index 0000000..1508737 --- /dev/null +++ b/generated/packages/ts/1_3/index.d.ts @@ -0,0 +1,406 @@ +export type Openrpc = "1.3.2" | "1.3.1" | "1.3.0" | "1.2.6" | "1.2.5" | "1.2.4" | "1.2.3" | "1.2.2" | "1.2.1" | "1.2.0" | "1.1.12" | "1.1.11" | "1.1.10" | "1.1.9" | "1.1.8" | "1.1.7" | "1.1.6" | "1.1.5" | "1.1.4" | "1.1.3" | "1.1.2" | "1.1.1" | "1.1.0" | "1.0.0" | "1.0.0-rc0" | "1.0.0-rc1"; +export type InfoObjectProperties = string; +export type InfoObjectDescription = string; +export type InfoObjectTermsOfService = string; +export type InfoObjectVersion = string; +export type ContactObjectName = string; +export type ContactObjectEmail = string; +export type ContactObjectUrl = string; +export type SpecificationExtension = any; +export interface ContactObject { + name?: ContactObjectName; + email?: ContactObjectEmail; + url?: ContactObjectUrl; + [regex: string]: SpecificationExtension | any; +} +export type LicenseObjectName = string; +export type LicenseObjectUrl = string; +export interface LicenseObject { + name?: LicenseObjectName; + url?: LicenseObjectUrl; + [regex: string]: SpecificationExtension | any; +} +export interface InfoObject { + title: InfoObjectProperties; + description?: InfoObjectDescription; + termsOfService?: InfoObjectTermsOfService; + version: InfoObjectVersion; + contact?: ContactObject; + license?: LicenseObject; + [regex: string]: SpecificationExtension | any; +} +export type ExternalDocumentationObjectDescription = string; +export type ExternalDocumentationObjectUrl = string; +/** + * + * information about external documentation + * + */ +export interface ExternalDocumentationObject { + description?: ExternalDocumentationObjectDescription; + url: ExternalDocumentationObjectUrl; + [regex: string]: SpecificationExtension | any; +} +export type ServerObjectUrl = string; +export type ServerObjectName = string; +export type ServerObjectDescription = string; +export type ServerObjectSummary = string; +export type ServerObjectVariableDefault = string; +export type ServerObjectVariableDescription = string; +export type ServerObjectVariableEnumItem = string; +export type ServerObjectVariableEnum = ServerObjectVariableEnumItem[]; +export interface ServerObjectVariable { + default: ServerObjectVariableDefault; + description?: ServerObjectVariableDescription; + enum?: ServerObjectVariableEnum; + [k: string]: any; +} +export interface ServerObjectVariables { + [key: string]: any; +} +export interface ServerObject { + url: ServerObjectUrl; + name?: ServerObjectName; + description?: ServerObjectDescription; + summary?: ServerObjectSummary; + variables?: ServerObjectVariables; + [regex: string]: SpecificationExtension | any; +} +export type Servers = ServerObject[]; +/** + * + * The cannonical name for the method. The name MUST be unique within the methods array. + * + */ +export type MethodObjectName = string; +/** + * + * A verbose explanation of the method behavior. GitHub Flavored Markdown syntax MAY be used for rich text representation. + * + */ +export type MethodObjectDescription = string; +/** + * + * A short summary of what the method does. + * + */ +export type MethodObjectSummary = string; +export type TagObjectName = string; +export type TagObjectDescription = string; +export interface TagObject { + name: TagObjectName; + description?: TagObjectDescription; + externalDocs?: ExternalDocumentationObject; + [regex: string]: SpecificationExtension | any; +} +export type $Ref = string; +export interface ReferenceObject { + $ref: $Ref; +} +export type TagOrReference = TagObject | ReferenceObject; +export type MethodObjectTags = TagOrReference[]; +/** + * + * Format the server expects the params. Defaults to 'either'. + * + * @default either + * + */ +export type MethodObjectParamStructure = "by-position" | "by-name" | "either"; +export type ContentDescriptorObjectName = string; +export type ContentDescriptorObjectDescription = string; +export type ContentDescriptorObjectSummary = string; +export type $Id = string; +export type $Schema = string; +export type $Comment = string; +export type Title = string; +export type Description = string; +type AlwaysTrue = any; +export type ReadOnly = boolean; +export type Examples = AlwaysTrue[]; +export type MultipleOf = number; +export type Maximum = number; +export type ExclusiveMaximum = number; +export type Minimum = number; +export type ExclusiveMinimum = number; +export type NonNegativeInteger = number; +export type NonNegativeIntegerDefaultZero = number; +export type Pattern = string; +export type SchemaArray = JSONSchema[]; +/** + * + * @default true + * + */ +export type Items = JSONSchema | SchemaArray; +export type UniqueItems = boolean; +export type StringDoaGddGA = string; +/** + * + * @default [] + * + */ +export type StringArray = StringDoaGddGA[]; +/** + * + * @default {} + * + */ +export interface Definitions { + [key: string]: any; +} +/** + * + * @default {} + * + */ +export interface Properties { + [key: string]: any; +} +export type PropertyNames = any; +/** + * + * @default {} + * + */ +export interface PatternProperties { + [key: string]: any; +} +export type DependenciesSet = JSONSchema | StringArray; +export interface Dependencies { + [key: string]: any; +} +export type Enum = AlwaysTrue[]; +export type SimpleTypes = "array" | "boolean" | "integer" | "null" | "number" | "object" | "string"; +export type ArrayOfSimpleTypes = SimpleTypes[]; +export type Type = SimpleTypes | ArrayOfSimpleTypes; +export type Format = string; +export type ContentMediaType = string; +export type ContentEncoding = string; +export interface JSONSchemaObject { + $id?: $Id; + $schema?: $Schema; + $ref?: $Ref; + $comment?: $Comment; + title?: Title; + description?: Description; + default?: AlwaysTrue; + readOnly?: ReadOnly; + examples?: Examples; + multipleOf?: MultipleOf; + maximum?: Maximum; + exclusiveMaximum?: ExclusiveMaximum; + minimum?: Minimum; + exclusiveMinimum?: ExclusiveMinimum; + maxLength?: NonNegativeInteger; + minLength?: NonNegativeIntegerDefaultZero; + pattern?: Pattern; + additionalItems?: JSONSchema; + items?: Items; + maxItems?: NonNegativeInteger; + minItems?: NonNegativeIntegerDefaultZero; + uniqueItems?: UniqueItems; + contains?: JSONSchema; + maxProperties?: NonNegativeInteger; + minProperties?: NonNegativeIntegerDefaultZero; + required?: StringArray; + additionalProperties?: JSONSchema; + definitions?: Definitions; + properties?: Properties; + patternProperties?: PatternProperties; + dependencies?: Dependencies; + propertyNames?: JSONSchema; + const?: AlwaysTrue; + enum?: Enum; + type?: Type; + format?: Format; + contentMediaType?: ContentMediaType; + contentEncoding?: ContentEncoding; + if?: JSONSchema; + then?: JSONSchema; + else?: JSONSchema; + allOf?: SchemaArray; + anyOf?: SchemaArray; + oneOf?: SchemaArray; + not?: JSONSchema; + [k: string]: any; +} +/** + * + * Always valid if true. Never valid if false. Is constant. + * + */ +export type JSONSchemaBoolean = boolean; +/** + * + * @default {} + * + */ +export type JSONSchema = JSONSchemaObject | JSONSchemaBoolean; +export type ContentDescriptorObjectRequired = boolean; +export type ContentDescriptorObjectDeprecated = boolean; +export interface ContentDescriptorObject { + name: ContentDescriptorObjectName; + description?: ContentDescriptorObjectDescription; + summary?: ContentDescriptorObjectSummary; + schema: JSONSchema; + required?: ContentDescriptorObjectRequired; + deprecated?: ContentDescriptorObjectDeprecated; + [regex: string]: SpecificationExtension | any; +} +export type ContentDescriptorOrReference = ContentDescriptorObject | ReferenceObject; +export type MethodObjectParams = ContentDescriptorOrReference[]; +export type MethodObjectResult = ContentDescriptorObject | ReferenceObject; +/** + * + * A Number that indicates the error type that occurred. This MUST be an integer. The error codes from and including -32768 to -32000 are reserved for pre-defined errors. These pre-defined errors SHOULD be assumed to be returned from any JSON-RPC api. + * + */ +export type ErrorObjectCode = number; +/** + * + * A String providing a short description of the error. The message SHOULD be limited to a concise single sentence. + * + */ +export type ErrorObjectMessage = string; +/** + * + * A Primitive or Structured value that contains additional information about the error. This may be omitted. The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.). + * + */ +export type ErrorObjectData = any; +/** + * + * Defines an application level error. + * + */ +export interface ErrorObject { + code: ErrorObjectCode; + message: ErrorObjectMessage; + data?: ErrorObjectData; +} +export type ErrorOrReference = ErrorObject | ReferenceObject; +/** + * + * Defines an application level error. + * + */ +export type MethodObjectErrors = ErrorOrReference[]; +export type LinkObjectName = string; +export type LinkObjectSummary = string; +export type LinkObjectMethod = string; +export type LinkObjectDescription = string; +export type LinkObjectParams = any; +export interface LinkObjectServer { + url: ServerObjectUrl; + name?: ServerObjectName; + description?: ServerObjectDescription; + summary?: ServerObjectSummary; + variables?: ServerObjectVariables; + [regex: string]: SpecificationExtension | any; +} +export interface LinkObject { + name?: LinkObjectName; + summary?: LinkObjectSummary; + method?: LinkObjectMethod; + description?: LinkObjectDescription; + params?: LinkObjectParams; + server?: LinkObjectServer; + [regex: string]: SpecificationExtension | any; +} +export type LinkOrReference = LinkObject | ReferenceObject; +export type MethodObjectLinks = LinkOrReference[]; +export type ExamplePairingObjectName = string; +export type ExamplePairingObjectDescription = string; +export type ExampleObjectSummary = string; +export type ExampleObjectValue = any; +export type ExampleObjectDescription = string; +export type ExampleObjectName = string; +export interface ExampleObject { + summary?: ExampleObjectSummary; + value: ExampleObjectValue; + description?: ExampleObjectDescription; + name: ExampleObjectName; + [regex: string]: SpecificationExtension | any; +} +export type ExampleOrReference = ExampleObject | ReferenceObject; +export type ExamplePairingObjectParams = ExampleOrReference[]; +export type ExamplePairingObjectResult = ExampleObject | ReferenceObject; +export interface ExamplePairingObject { + name: ExamplePairingObjectName; + description?: ExamplePairingObjectDescription; + params: ExamplePairingObjectParams; + result?: ExamplePairingObjectResult; + [k: string]: any; +} +export type ExamplePairingOrReference = ExamplePairingObject | ReferenceObject; +export type MethodObjectExamples = ExamplePairingOrReference[]; +export type MethodObjectDeprecated = boolean; +export interface MethodObject { + name: MethodObjectName; + description?: MethodObjectDescription; + summary?: MethodObjectSummary; + servers?: Servers; + tags?: MethodObjectTags; + paramStructure?: MethodObjectParamStructure; + params: MethodObjectParams; + result?: MethodObjectResult; + errors?: MethodObjectErrors; + links?: MethodObjectLinks; + examples?: MethodObjectExamples; + deprecated?: MethodObjectDeprecated; + externalDocs?: ExternalDocumentationObject; + [regex: string]: SpecificationExtension | any; +} +export type MethodOrReference = MethodObject | ReferenceObject; +export type Methods = MethodOrReference[]; +export interface SchemaComponents { + [key: string]: any; +} +export interface LinkComponents { + [key: string]: any; +} +export interface ErrorComponents { + [key: string]: any; +} +export interface ExampleComponents { + [key: string]: any; +} +export interface ExamplePairingComponents { + [key: string]: any; +} +export interface ContentDescriptorComponents { + [key: string]: any; +} +export interface TagComponents { + [key: string]: any; +} +export interface Components { + schemas?: SchemaComponents; + links?: LinkComponents; + errors?: ErrorComponents; + examples?: ExampleComponents; + examplePairings?: ExamplePairingComponents; + contentDescriptors?: ContentDescriptorComponents; + tags?: TagComponents; + [k: string]: any; +} +/** + * + * JSON Schema URI (used by some editors) + * + * @default https://meta.open-rpc.org/ + * + */ +export type MetaSchema = string; +export interface OpenrpcDocument { + openrpc: Openrpc; + info: InfoObject; + externalDocs?: ExternalDocumentationObject; + servers?: Servers; + methods: Methods; + components?: Components; + $schema?: MetaSchema; + [regex: string]: SpecificationExtension | any; +} +export {}; diff --git a/generated/packages/ts/1_3/index.js b/generated/packages/ts/1_3/index.js new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/generated/packages/ts/1_3/index.js @@ -0,0 +1 @@ +export {}; diff --git a/generated/packages/ts/1_3/index.ts b/generated/packages/ts/1_3/index.ts new file mode 100644 index 0000000..4550a42 --- /dev/null +++ b/generated/packages/ts/1_3/index.ts @@ -0,0 +1,382 @@ +export type Openrpc = "1.3.2" | "1.3.1" | "1.3.0" | "1.2.6" | "1.2.5" | "1.2.4" | "1.2.3" | "1.2.2" | "1.2.1" | "1.2.0" | "1.1.12" | "1.1.11" | "1.1.10" | "1.1.9" | "1.1.8" | "1.1.7" | "1.1.6" | "1.1.5" | "1.1.4" | "1.1.3" | "1.1.2" | "1.1.1" | "1.1.0" | "1.0.0" | "1.0.0-rc0" | "1.0.0-rc1"; +export type InfoObjectProperties = string; +export type InfoObjectDescription = string; +export type InfoObjectTermsOfService = string; +export type InfoObjectVersion = string; +export type ContactObjectName = string; +export type ContactObjectEmail = string; +export type ContactObjectUrl = string; +export type SpecificationExtension = any; +export interface ContactObject { + name?: ContactObjectName; + email?: ContactObjectEmail; + url?: ContactObjectUrl; + [regex: string]: SpecificationExtension | any; +} +export type LicenseObjectName = string; +export type LicenseObjectUrl = string; +export interface LicenseObject { + name?: LicenseObjectName; + url?: LicenseObjectUrl; + [regex: string]: SpecificationExtension | any; +} +export interface InfoObject { + title: InfoObjectProperties; + description?: InfoObjectDescription; + termsOfService?: InfoObjectTermsOfService; + version: InfoObjectVersion; + contact?: ContactObject; + license?: LicenseObject; + [regex: string]: SpecificationExtension | any; +} +export type ExternalDocumentationObjectDescription = string; +export type ExternalDocumentationObjectUrl = string; +/** + * + * information about external documentation + * + */ +export interface ExternalDocumentationObject { + description?: ExternalDocumentationObjectDescription; + url: ExternalDocumentationObjectUrl; + [regex: string]: SpecificationExtension | any; +} +export type ServerObjectUrl = string; +export type ServerObjectName = string; +export type ServerObjectDescription = string; +export type ServerObjectSummary = string; +export type ServerObjectVariableDefault = string; +export type ServerObjectVariableDescription = string; +export type ServerObjectVariableEnumItem = string; +export type ServerObjectVariableEnum = ServerObjectVariableEnumItem[]; +export interface ServerObjectVariable { + default: ServerObjectVariableDefault; + description?: ServerObjectVariableDescription; + enum?: ServerObjectVariableEnum; + [k: string]: any; +} +export interface ServerObjectVariables { [key: string]: any; } +export interface ServerObject { + url: ServerObjectUrl; + name?: ServerObjectName; + description?: ServerObjectDescription; + summary?: ServerObjectSummary; + variables?: ServerObjectVariables; + [regex: string]: SpecificationExtension | any; +} +type AlwaysFalse = any; +export type Servers = ServerObject[]; +/** + * + * The cannonical name for the method. The name MUST be unique within the methods array. + * + */ +export type MethodObjectName = string; +/** + * + * A verbose explanation of the method behavior. GitHub Flavored Markdown syntax MAY be used for rich text representation. + * + */ +export type MethodObjectDescription = string; +/** + * + * A short summary of what the method does. + * + */ +export type MethodObjectSummary = string; +export type TagObjectName = string; +export type TagObjectDescription = string; +export interface TagObject { + name: TagObjectName; + description?: TagObjectDescription; + externalDocs?: ExternalDocumentationObject; + [regex: string]: SpecificationExtension | any; +} +export type $Ref = string; +export interface ReferenceObject { + $ref: $Ref; +} +export type TagOrReference = TagObject | ReferenceObject; +export type MethodObjectTags = TagOrReference[]; +/** + * + * Format the server expects the params. Defaults to 'either'. + * + * @default either + * + */ +export type MethodObjectParamStructure = "by-position" | "by-name" | "either"; +export type ContentDescriptorObjectName = string; +export type ContentDescriptorObjectDescription = string; +export type ContentDescriptorObjectSummary = string; +export type $Id = string; +export type $Schema = string; +export type $Comment = string; +export type Title = string; +export type Description = string; +type AlwaysTrue = any; +export type ReadOnly = boolean; +export type Examples = AlwaysTrue[]; +export type MultipleOf = number; +export type Maximum = number; +export type ExclusiveMaximum = number; +export type Minimum = number; +export type ExclusiveMinimum = number; +export type NonNegativeInteger = number; +export type NonNegativeIntegerDefaultZero = number; +export type Pattern = string; +export type SchemaArray = JSONSchema[]; +/** + * + * @default true + * + */ +export type Items = JSONSchema | SchemaArray; +export type UniqueItems = boolean; +export type StringDoaGddGA = string; +/** + * + * @default [] + * + */ +export type StringArray = StringDoaGddGA[]; +/** + * + * @default {} + * + */ +export interface Definitions { [key: string]: any; } +/** + * + * @default {} + * + */ +export interface Properties { [key: string]: any; } +export type PropertyNames = any; +/** + * + * @default {} + * + */ +export interface PatternProperties { [key: string]: any; } +export type DependenciesSet = JSONSchema | StringArray; +export interface Dependencies { [key: string]: any; } +export type Enum = AlwaysTrue[]; +export type SimpleTypes = "array" | "boolean" | "integer" | "null" | "number" | "object" | "string"; +export type ArrayOfSimpleTypes = SimpleTypes[]; +export type Type = SimpleTypes | ArrayOfSimpleTypes; +export type Format = string; +export type ContentMediaType = string; +export type ContentEncoding = string; +export interface JSONSchemaObject { + $id?: $Id; + $schema?: $Schema; + $ref?: $Ref; + $comment?: $Comment; + title?: Title; + description?: Description; + default?: AlwaysTrue; + readOnly?: ReadOnly; + examples?: Examples; + multipleOf?: MultipleOf; + maximum?: Maximum; + exclusiveMaximum?: ExclusiveMaximum; + minimum?: Minimum; + exclusiveMinimum?: ExclusiveMinimum; + maxLength?: NonNegativeInteger; + minLength?: NonNegativeIntegerDefaultZero; + pattern?: Pattern; + additionalItems?: JSONSchema; + items?: Items; + maxItems?: NonNegativeInteger; + minItems?: NonNegativeIntegerDefaultZero; + uniqueItems?: UniqueItems; + contains?: JSONSchema; + maxProperties?: NonNegativeInteger; + minProperties?: NonNegativeIntegerDefaultZero; + required?: StringArray; + additionalProperties?: JSONSchema; + definitions?: Definitions; + properties?: Properties; + patternProperties?: PatternProperties; + dependencies?: Dependencies; + propertyNames?: JSONSchema; + const?: AlwaysTrue; + enum?: Enum; + type?: Type; + format?: Format; + contentMediaType?: ContentMediaType; + contentEncoding?: ContentEncoding; + if?: JSONSchema; + then?: JSONSchema; + else?: JSONSchema; + allOf?: SchemaArray; + anyOf?: SchemaArray; + oneOf?: SchemaArray; + not?: JSONSchema; + [k: string]: any; +} +/** + * + * Always valid if true. Never valid if false. Is constant. + * + */ +export type JSONSchemaBoolean = boolean; +/** + * + * @default {} + * + */ +export type JSONSchema = JSONSchemaObject | JSONSchemaBoolean; +export type ContentDescriptorObjectRequired = boolean; +export type ContentDescriptorObjectDeprecated = boolean; +export interface ContentDescriptorObject { + name: ContentDescriptorObjectName; + description?: ContentDescriptorObjectDescription; + summary?: ContentDescriptorObjectSummary; + schema: JSONSchema; + required?: ContentDescriptorObjectRequired; + deprecated?: ContentDescriptorObjectDeprecated; + [regex: string]: SpecificationExtension | any; +} +export type ContentDescriptorOrReference = ContentDescriptorObject | ReferenceObject; +export type MethodObjectParams = ContentDescriptorOrReference[]; +export type MethodObjectResult = ContentDescriptorObject | ReferenceObject; +/** + * + * A Number that indicates the error type that occurred. This MUST be an integer. The error codes from and including -32768 to -32000 are reserved for pre-defined errors. These pre-defined errors SHOULD be assumed to be returned from any JSON-RPC api. + * + */ +export type ErrorObjectCode = number; +/** + * + * A String providing a short description of the error. The message SHOULD be limited to a concise single sentence. + * + */ +export type ErrorObjectMessage = string; +/** + * + * A Primitive or Structured value that contains additional information about the error. This may be omitted. The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.). + * + */ +export type ErrorObjectData = any; +/** + * + * Defines an application level error. + * + */ +export interface ErrorObject { + code: ErrorObjectCode; + message: ErrorObjectMessage; + data?: ErrorObjectData; +} +export type ErrorOrReference = ErrorObject | ReferenceObject; +/** + * + * Defines an application level error. + * + */ +export type MethodObjectErrors = ErrorOrReference[]; +export type LinkObjectName = string; +export type LinkObjectSummary = string; +export type LinkObjectMethod = string; +export type LinkObjectDescription = string; +export type LinkObjectParams = any; +export interface LinkObjectServer { + url: ServerObjectUrl; + name?: ServerObjectName; + description?: ServerObjectDescription; + summary?: ServerObjectSummary; + variables?: ServerObjectVariables; + [regex: string]: SpecificationExtension | any; +} +export interface LinkObject { + name?: LinkObjectName; + summary?: LinkObjectSummary; + method?: LinkObjectMethod; + description?: LinkObjectDescription; + params?: LinkObjectParams; + server?: LinkObjectServer; + [regex: string]: SpecificationExtension | any; +} +export type LinkOrReference = LinkObject | ReferenceObject; +export type MethodObjectLinks = LinkOrReference[]; +export type ExamplePairingObjectName = string; +export type ExamplePairingObjectDescription = string; +export type ExampleObjectSummary = string; +export type ExampleObjectValue = any; +export type ExampleObjectDescription = string; +export type ExampleObjectName = string; +export interface ExampleObject { + summary?: ExampleObjectSummary; + value: ExampleObjectValue; + description?: ExampleObjectDescription; + name: ExampleObjectName; + [regex: string]: SpecificationExtension | any; +} +export type ExampleOrReference = ExampleObject | ReferenceObject; +export type ExamplePairingObjectParams = ExampleOrReference[]; +export type ExamplePairingObjectResult = ExampleObject | ReferenceObject; +export interface ExamplePairingObject { + name: ExamplePairingObjectName; + description?: ExamplePairingObjectDescription; + params: ExamplePairingObjectParams; + result?: ExamplePairingObjectResult; + [k: string]: any; +} +export type ExamplePairingOrReference = ExamplePairingObject | ReferenceObject; +export type MethodObjectExamples = ExamplePairingOrReference[]; +export type MethodObjectDeprecated = boolean; +export interface MethodObject { + name: MethodObjectName; + description?: MethodObjectDescription; + summary?: MethodObjectSummary; + servers?: Servers; + tags?: MethodObjectTags; + paramStructure?: MethodObjectParamStructure; + params: MethodObjectParams; + result?: MethodObjectResult; + errors?: MethodObjectErrors; + links?: MethodObjectLinks; + examples?: MethodObjectExamples; + deprecated?: MethodObjectDeprecated; + externalDocs?: ExternalDocumentationObject; + [regex: string]: SpecificationExtension | any; +} +export type MethodOrReference = MethodObject | ReferenceObject; +export type Methods = MethodOrReference[]; +export interface SchemaComponents { [key: string]: any; } +export interface LinkComponents { [key: string]: any; } +export interface ErrorComponents { [key: string]: any; } +export interface ExampleComponents { [key: string]: any; } +export interface ExamplePairingComponents { [key: string]: any; } +export interface ContentDescriptorComponents { [key: string]: any; } +export interface TagComponents { [key: string]: any; } +export interface Components { + schemas?: SchemaComponents; + links?: LinkComponents; + errors?: ErrorComponents; + examples?: ExampleComponents; + examplePairings?: ExamplePairingComponents; + contentDescriptors?: ContentDescriptorComponents; + tags?: TagComponents; + [k: string]: any; +} +/** + * + * JSON Schema URI (used by some editors) + * + * @default https://meta.open-rpc.org/ + * + */ +export type MetaSchema = string; +export interface OpenrpcDocument { + openrpc: Openrpc; + info: InfoObject; + externalDocs?: ExternalDocumentationObject; + servers?: Servers; + methods: Methods; + components?: Components; + $schema?: MetaSchema; + [regex: string]: SpecificationExtension | any; +} \ No newline at end of file diff --git a/generated/packages/ts/1_4/index.d.ts b/generated/packages/ts/1_4/index.d.ts new file mode 100644 index 0000000..ded167d --- /dev/null +++ b/generated/packages/ts/1_4/index.d.ts @@ -0,0 +1,748 @@ +/** + * + * This string MUST be the [semantic version number](https://semver.org/spec/v2.0.0.html) of the [OpenRPC Specification version](#versions) that the OpenRPC document uses. The `openrpc` field SHOULD be used by tooling specifications and clients to interpret the OpenRPC document. This is *not* related to the API [`info.version`](#info-version) string. + * + */ +export type Openrpc = string; +/** + * + * The title of the application. + * + */ +export type InfoObjectTitle = string; +/** + * + * A verbose description of the application. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. + * + */ +export type InfoObjectDescription = string; +/** + * + * A URL to the Terms of Service for the API. MUST be in the format of a URL. + * + */ +export type InfoObjectTermsOfService = string; +/** + * + * The version of the OpenRPC document (which is distinct from the [OpenRPC Specification version](#openrpc-document-openrpc) or the API implementation version). + * + */ +export type InfoObjectVersion = string; +/** + * + * The identifying name of the contact person/organization. + * + */ +export type ContactObjectName = string; +/** + * + * The email address of the contact person/organization. MUST be in the format of an email address. + * + */ +export type ContactObjectEmail = string; +/** + * + * The URL pointing to the contact information. MUST be in the format of a URL. + * + */ +export type ContactObjectUrl = string; +/** + * + * This object MAY be extended with [Specification Extensions](#specification-extensions). + * + */ +export type SpecificationExtension = any; +/** + * + * Contact information for the exposed API. + * + */ +export interface ContactObject { + name?: ContactObjectName; + email?: ContactObjectEmail; + url?: ContactObjectUrl; + [regex: string]: SpecificationExtension | any; +} +/** + * + * The license name used for the API. + * + */ +export type LicenseObjectName = string; +/** + * + * A URL to the license used for the API. MUST be in the format of a URL. + * + */ +export type LicenseObjectUrl = string; +/** + * + * License information for the exposed API. + * + */ +export interface LicenseObject { + name?: LicenseObjectName; + url?: LicenseObjectUrl; + [regex: string]: SpecificationExtension | any; +} +/** + * + * The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience. + * + */ +export type InfoObject = any; +/** + * + * A verbose explanation of the documentation. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. + * + */ +export type ExternalDocumentationObjectDescription = string; +/** + * + * The URL for the target documentation. Value MUST be in the format of a URL. + * + */ +export type ExternalDocumentationObjectUrl = string; +/** + * + * Additional external documentation for this tag. + * + */ +export interface ExternalDocumentationObject { + description?: ExternalDocumentationObjectDescription; + url: ExternalDocumentationObjectUrl; + [regex: string]: SpecificationExtension | any; +} +/** + * + * A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenRPC document is being served. [Server Variables](#server-variables) are passed into the [Runtime Expression](#runtime-expression) to produce a server URL. + * + */ +export type ServerObjectUrl = string; +/** + * + * An optional string describing the name of the server. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. + * + */ +export type ServerObjectName = string; +/** + * + * An optional string describing the host designated by the URL. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. + * + */ +export type ServerObjectDescription = string; +/** + * + * A short summary of what the server is. + * + */ +export type ServerObjectSummary = string; +/** + * + * The default value to use for substitution, which SHALL be sent if an alternate value is _not_ supplied. Note this behavior is different than the [Schema Object's](#schema-object) treatment of default values, because in those cases parameter values are optional. + * + */ +export type ServerObjectVariableDefault = string; +/** + * + * An optional description for the server variable. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. + * + */ +export type ServerObjectVariableDescription = string; +/** + * + * An enumeration of string values to be used if the substitution options are from a limited set. + * + */ +export type ServerObjectVariableEnumItem = string; +/** + * + * An enumeration of string values to be used if the substitution options are from a limited set. + * + */ +export type ServerObjectVariableEnum = ServerObjectVariableEnumItem[]; +/** + * + * An object representing a Server Variable for server URL template substitution. + * + */ +export interface ServerObjectVariable { + default: ServerObjectVariableDefault; + description?: ServerObjectVariableDescription; + enum?: ServerObjectVariableEnum; + [k: string]: any; +} +/** + * + * A map between a variable name and its value. The value is passed into the [Runtime Expression](#runtime-expression) to produce a server URL. + * + */ +export interface ServerObjectVariables { + [key: string]: any; +} +/** + * + * A object representing a Server + * + */ +export interface ServerObject { + url: ServerObjectUrl; + name?: ServerObjectName; + description?: ServerObjectDescription; + summary?: ServerObjectSummary; + variables?: ServerObjectVariables; + [regex: string]: SpecificationExtension | any; +} +/** + * + * An array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](#server-object) with a [url](#server-url) value of `localhost`. + * + */ +export type Servers = ServerObject[]; +/** + * + * The cannonical name for the method. The name MUST be unique within the methods array. + * + */ +export type MethodObjectName = string; +/** + * + * A verbose explanation of the method behavior. GitHub Flavored Markdown syntax MAY be used for rich text representation. + * + */ +export type MethodObjectDescription = string; +/** + * + * A short summary of what the method does. + * + */ +export type MethodObjectSummary = string; +/** + * + * The name of the tag. + * + */ +export type TagObjectName = string; +/** + * + * A verbose explanation for the tag. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. + * + */ +export type TagObjectDescription = string; +/** + * + * Adds metadata to a single tag that is used by the [Method Object](#method-object). It is not mandatory to have a Tag Object per tag defined in the Method Object instances. + * + */ +export interface TagObject { + name: TagObjectName; + description?: TagObjectDescription; + externalDocs?: ExternalDocumentationObject; + [regex: string]: SpecificationExtension | any; +} +export type $Ref = string; +export interface ReferenceObject { + $ref: $Ref; +} +export type TagOrReference = TagObject | ReferenceObject; +/** + * + * A list of tags for API documentation control. Tags can be used for logical grouping of methods by resources or any other qualifier. + * + */ +export type MethodObjectTags = TagOrReference[]; +/** + * + * Format the server expects the params. Defaults to 'either'. + * + * @default either + * + */ +export type MethodObjectParamStructure = "by-position" | "by-name" | "either"; +/** + * + * Name of the content that is being described. If the content described is a method parameter assignable [`by-name`](#method-param-structure), this field SHALL define the parameter's key (ie name). + * + */ +export type ContentDescriptorObjectName = string; +/** + * + * A verbose explanation of the content descriptor behavior. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. + * + */ +export type ContentDescriptorObjectDescription = string; +/** + * + * A short summary of the content that is being described. + * + */ +export type ContentDescriptorObjectSummary = string; +export type $Id = string; +export type $Schema = string; +export type $Comment = string; +export type Title = string; +export type Description = string; +type AlwaysTrue = any; +export type ReadOnly = boolean; +export type Examples = AlwaysTrue[]; +export type MultipleOf = number; +export type Maximum = number; +export type ExclusiveMaximum = number; +export type Minimum = number; +export type ExclusiveMinimum = number; +export type NonNegativeInteger = number; +export type NonNegativeIntegerDefaultZero = number; +export type Pattern = string; +/** + * + * Always valid if true. Never valid if false. Is constant. + * + */ +export type JSONSchemaBoolean = boolean; +/** + * + * @default {} + * + */ +export type JSONSchema = JSONSchemaObject | JSONSchemaBoolean; +export type SchemaArray = JSONSchema[]; +/** + * + * @default true + * + */ +export type Items = JSONSchema | SchemaArray; +export type UniqueItems = boolean; +export type StringDoaGddGA = string; +/** + * + * @default [] + * + */ +export type StringArray = StringDoaGddGA[]; +/** + * + * @default {} + * + */ +export interface Definitions { + [key: string]: any; +} +/** + * + * @default {} + * + */ +export interface Properties { + [key: string]: any; +} +export type PropertyNames = any; +/** + * + * @default {} + * + */ +export interface PatternProperties { + [key: string]: any; +} +export type DependenciesSet = JSONSchema | StringArray; +export interface Dependencies { + [key: string]: any; +} +export type Enum = AlwaysTrue[]; +export type SimpleTypes = "array" | "boolean" | "integer" | "null" | "number" | "object" | "string"; +export type ArrayOfSimpleTypes = SimpleTypes[]; +export type Type = SimpleTypes | ArrayOfSimpleTypes; +export type Format = string; +export type ContentMediaType = string; +export type ContentEncoding = string; +export interface JSONSchemaObject { + $id?: $Id; + $schema?: $Schema; + $ref?: $Ref; + $comment?: $Comment; + title?: Title; + description?: Description; + default?: AlwaysTrue; + readOnly?: ReadOnly; + examples?: Examples; + multipleOf?: MultipleOf; + maximum?: Maximum; + exclusiveMaximum?: ExclusiveMaximum; + minimum?: Minimum; + exclusiveMinimum?: ExclusiveMinimum; + maxLength?: NonNegativeInteger; + minLength?: NonNegativeIntegerDefaultZero; + pattern?: Pattern; + additionalItems?: JSONSchema; + items?: Items; + maxItems?: NonNegativeInteger; + minItems?: NonNegativeIntegerDefaultZero; + uniqueItems?: UniqueItems; + contains?: JSONSchema; + maxProperties?: NonNegativeInteger; + minProperties?: NonNegativeIntegerDefaultZero; + required?: StringArray; + additionalProperties?: JSONSchema; + definitions?: Definitions; + properties?: Properties; + patternProperties?: PatternProperties; + dependencies?: Dependencies; + propertyNames?: JSONSchema; + const?: AlwaysTrue; + enum?: Enum; + type?: Type; + format?: Format; + contentMediaType?: ContentMediaType; + contentEncoding?: ContentEncoding; + if?: JSONSchema; + then?: JSONSchema; + else?: JSONSchema; + allOf?: SchemaArray; + anyOf?: SchemaArray; + oneOf?: SchemaArray; + not?: JSONSchema; + [k: string]: any; +} +/** + * + * Schema that describes the content. + * + * @default {} + * + */ +export type ContentDescriptorObjectSchema = JSONSchemaObject | JSONSchemaBoolean; +/** + * + * Determines if the content is a required field. Default value is `false`. + * + */ +export type ContentDescriptorObjectRequired = boolean; +/** + * + * Specifies that the content is deprecated and SHOULD be transitioned out of usage. Default value is `false`. + * + */ +export type ContentDescriptorObjectDeprecated = boolean; +/** + * + * Content Descriptors are objects that do just as they suggest - describe content. They are reusable ways of describing either parameters or result. They MUST have a schema. + * + */ +export interface ContentDescriptorObject { + name: ContentDescriptorObjectName; + description?: ContentDescriptorObjectDescription; + summary?: ContentDescriptorObjectSummary; + schema: ContentDescriptorObjectSchema; + required?: ContentDescriptorObjectRequired; + deprecated?: ContentDescriptorObjectDeprecated; + [regex: string]: SpecificationExtension | any; +} +export type ContentDescriptorOrReference = ContentDescriptorObject | ReferenceObject; +/** + * + * A list of parameters that are applicable for this method. The list MUST NOT include duplicated parameters and therefore require [name](#content-descriptor-name) to be unique. The list can use the [Reference Object](#reference-object) to link to parameters that are defined by the [Content Descriptor Object](#content-descriptor-object). All optional params (content descriptor objects with "required": false) MUST be positioned after all required params in the list. + * + */ +export type MethodObjectParams = ContentDescriptorOrReference[]; +/** + * + * The description of the result returned by the method. If defined, it MUST be a Content Descriptor or Reference Object. If undefined, the method MUST only be used as a [notification](https://www.jsonrpc.org/specification#notification) + * + */ +export type MethodObjectResult = ContentDescriptorObject | ReferenceObject; +/** + * + * A Number that indicates the error type that occurred. This MUST be an integer. The error codes from and including -32768 to -32000 are reserved for pre-defined errors. These pre-defined errors SHOULD be assumed to be returned from any JSON-RPC api. + * + */ +export type ErrorObjectCode = number; +/** + * + * A String providing a short description of the error. The message SHOULD be limited to a concise single sentence. + * + */ +export type ErrorObjectMessage = string; +/** + * + * A Primitive or Structured value that contains additional information about the error. This may be omitted. The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.). + * + */ +export type ErrorObjectData = any; +/** + * + * Defines an application level error. + * + */ +export interface ErrorObject { + code: ErrorObjectCode; + message: ErrorObjectMessage; + data?: ErrorObjectData; +} +export type ErrorOrReference = ErrorObject | ReferenceObject; +/** + * + * A list of custom application defined errors that MAY be returned. The Errors MUST have unique error codes. + * + */ +export type MethodObjectErrors = ErrorOrReference[]; +/** + * + * Cannonical name of the link. + * + */ +export type LinkObjectName = any; +/** + * + * Short description for the link. + * + */ +export type LinkObjectSummary = string; +/** + * + * The name of an existing, resolvable OpenRPC method, as defined with a unique `method`. This field MUST resolve to a unique [Method Object](#method-object). As opposed to Open Api, Relative `method` values ARE NOT permitted. + * + */ +export type LinkObjectMethod = string; +/** + * + * A description of the link. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. + * + */ +export type LinkObjectDescription = string; +/** + * + * A map representing parameters to pass to a method as specified with `method`. The key is the parameter name to be used, whereas the value can be a constant or a [runtime expression](#runtime-expression) to be evaluated and passed to the linked method. + * + */ +export type LinkObjectParams = any; +/** + * + * A server object to be used by the target method. + * + */ +export interface LinkObjectServer { + url: ServerObjectUrl; + name?: ServerObjectName; + description?: ServerObjectDescription; + summary?: ServerObjectSummary; + variables?: ServerObjectVariables; + [regex: string]: SpecificationExtension | any; +} +/** + * + * A object representing a Link + * + */ +export type LinkObject = any; +export type LinkOrReference = LinkObject | ReferenceObject; +/** + * + * A list of possible links from this method call. + * + */ +export type MethodObjectLinks = LinkOrReference[]; +/** + * + * Name for the example pairing. + * + */ +export type ExamplePairingObjectName = string; +/** + * + * A verbose explanation of the example pairing. + * + */ +export type ExamplePairingObjectDescription = string; +/** + * + * Short description for the example. + * + */ +export type ExampleObjectSummary = string; +/** + * + * Embedded literal example. The `value` field and `externalValue` field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON, use a string value to contain the example, escaping where necessary. + * + */ +export type ExampleObjectValue = any; +/** + * + * A verbose explanation of the example. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. + * + */ +export type ExampleObjectDescription = string; +/** + * + * Cannonical name of the example. + * + */ +export type ExampleObjectName = string; +/** + * + * The Example object is an object that defines an example that is intended to match the `schema` of a given [Content Descriptor](#content-descriptor-object). + * + */ +export interface ExampleObject { + summary?: ExampleObjectSummary; + value: ExampleObjectValue; + description?: ExampleObjectDescription; + name: ExampleObjectName; + [regex: string]: SpecificationExtension | any; +} +export type ExampleOrReference = ExampleObject | ReferenceObject; +/** + * + * Example parameters. + * + */ +export type ExamplePairingObjectParams = ExampleOrReference[]; +/** + * + * Example result. When not provided, the example pairing represents usage of the method as a notification. + * + */ +export type ExamplePairingObjectResult = ExampleObject | ReferenceObject; +/** + * + * The Example Pairing object consists of a set of example params and result. The result is what you can expect from the JSON-RPC service given the exact params. + * + */ +export interface ExamplePairingObject { + name: ExamplePairingObjectName; + description?: ExamplePairingObjectDescription; + params: ExamplePairingObjectParams; + result?: ExamplePairingObjectResult; + [k: string]: any; +} +export type ExamplePairingOrReference = ExamplePairingObject | ReferenceObject; +/** + * + * Array of [Example Pairing Objects](#example-pairing-object) where each example includes a valid params-to-result [Content Descriptor](#content-descriptor-object) pairing. + * + */ +export type MethodObjectExamples = ExamplePairingOrReference[]; +/** + * + * Declares this method to be deprecated. Consumers SHOULD refrain from usage of the declared method. Default value is `false`. + * + */ +export type MethodObjectDeprecated = boolean; +/** + * + * Describes the interface for the given method name. The method name is used as the `method` field of the JSON-RPC body. It therefore MUST be unique. + * + */ +export interface MethodObject { + name: MethodObjectName; + description?: MethodObjectDescription; + summary?: MethodObjectSummary; + servers?: Servers; + tags?: MethodObjectTags; + paramStructure?: MethodObjectParamStructure; + params: MethodObjectParams; + result?: MethodObjectResult; + errors?: MethodObjectErrors; + links?: MethodObjectLinks; + examples?: MethodObjectExamples; + deprecated?: MethodObjectDeprecated; + externalDocs?: ExternalDocumentationObject; + [regex: string]: SpecificationExtension | any; +} +export type MethodOrReference = MethodObject | ReferenceObject; +/** + * + * The available methods for the API. While it is required, the array may be empty (to handle security filtering, for example). + * + */ +export type Methods = MethodOrReference[]; +/** + * + * An object to hold reusable [Schema Objects](#schema-object). + * + */ +export interface SchemaComponents { + [key: string]: any; +} +/** + * + * An object to hold reusable [Link Objects](#link-object). + * + */ +export interface LinkComponents { + [key: string]: any; +} +/** + * + * An object to hold reusable [Error Objects](#error-object). + * + */ +export interface ErrorComponents { + [key: string]: any; +} +/** + * + * An object to hold reusable [Example Objects](#example-object). + * + */ +export interface ExampleComponents { + [key: string]: any; +} +/** + * + * An object to hold reusable [Example Pairing Objects](#example-pairing-object). + * + */ +export interface ExamplePairingComponents { + [key: string]: any; +} +/** + * + * An object to hold reusable [Content Descriptor Objects](#content-descriptor-object). + * + */ +export interface ContentDescriptorComponents { + [key: string]: any; +} +/** + * + * An object to hold reusable [Tag Objects](#tag-object). + * + */ +export interface TagComponents { + [key: string]: any; +} +/** + * + * Holds a set of reusable objects for different aspects of the OpenRPC. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object. + * + */ +export interface Components { + schemas?: SchemaComponents; + links?: LinkComponents; + errors?: ErrorComponents; + examples?: ExampleComponents; + examplePairings?: ExamplePairingComponents; + contentDescriptors?: ContentDescriptorComponents; + tags?: TagComponents; + [k: string]: any; +} +/** + * + * JSON Schema URI (used by some editors) + * + * @default https://meta.open-rpc.org/ + * + */ +export type MetaSchema = string; +export interface OpenrpcDocument { + openrpc: Openrpc; + info: InfoObject; + externalDocs?: ExternalDocumentationObject; + servers?: Servers; + methods: Methods; + components?: Components; + $schema?: MetaSchema; + [regex: string]: SpecificationExtension | any; +} +export {}; diff --git a/generated/packages/ts/1_4/index.js b/generated/packages/ts/1_4/index.js new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/generated/packages/ts/1_4/index.js @@ -0,0 +1 @@ +export {}; diff --git a/generated/packages/ts/1_4/index.ts b/generated/packages/ts/1_4/index.ts new file mode 100644 index 0000000..f50dadf --- /dev/null +++ b/generated/packages/ts/1_4/index.ts @@ -0,0 +1,724 @@ +/** + * + * This string MUST be the [semantic version number](https://semver.org/spec/v2.0.0.html) of the [OpenRPC Specification version](#versions) that the OpenRPC document uses. The `openrpc` field SHOULD be used by tooling specifications and clients to interpret the OpenRPC document. This is *not* related to the API [`info.version`](#info-version) string. + * + */ +export type Openrpc = string; +/** + * + * The title of the application. + * + */ +export type InfoObjectTitle = string; +/** + * + * A verbose description of the application. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. + * + */ +export type InfoObjectDescription = string; +/** + * + * A URL to the Terms of Service for the API. MUST be in the format of a URL. + * + */ +export type InfoObjectTermsOfService = string; +/** + * + * The version of the OpenRPC document (which is distinct from the [OpenRPC Specification version](#openrpc-document-openrpc) or the API implementation version). + * + */ +export type InfoObjectVersion = string; +/** + * + * The identifying name of the contact person/organization. + * + */ +export type ContactObjectName = string; +/** + * + * The email address of the contact person/organization. MUST be in the format of an email address. + * + */ +export type ContactObjectEmail = string; +/** + * + * The URL pointing to the contact information. MUST be in the format of a URL. + * + */ +export type ContactObjectUrl = string; +/** + * + * This object MAY be extended with [Specification Extensions](#specification-extensions). + * + */ +export type SpecificationExtension = any; +/** + * + * Contact information for the exposed API. + * + */ +export interface ContactObject { + name?: ContactObjectName; + email?: ContactObjectEmail; + url?: ContactObjectUrl; + [regex: string]: SpecificationExtension | any; +} +/** + * + * The license name used for the API. + * + */ +export type LicenseObjectName = string; +/** + * + * A URL to the license used for the API. MUST be in the format of a URL. + * + */ +export type LicenseObjectUrl = string; +/** + * + * License information for the exposed API. + * + */ +export interface LicenseObject { + name?: LicenseObjectName; + url?: LicenseObjectUrl; + [regex: string]: SpecificationExtension | any; +} +/** + * + * The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience. + * + */ +export type InfoObject = any; +/** + * + * A verbose explanation of the documentation. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. + * + */ +export type ExternalDocumentationObjectDescription = string; +/** + * + * The URL for the target documentation. Value MUST be in the format of a URL. + * + */ +export type ExternalDocumentationObjectUrl = string; +/** + * + * Additional external documentation for this tag. + * + */ +export interface ExternalDocumentationObject { + description?: ExternalDocumentationObjectDescription; + url: ExternalDocumentationObjectUrl; + [regex: string]: SpecificationExtension | any; +} +/** + * + * A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenRPC document is being served. [Server Variables](#server-variables) are passed into the [Runtime Expression](#runtime-expression) to produce a server URL. + * + */ +export type ServerObjectUrl = string; +/** + * + * An optional string describing the name of the server. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. + * + */ +export type ServerObjectName = string; +/** + * + * An optional string describing the host designated by the URL. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. + * + */ +export type ServerObjectDescription = string; +/** + * + * A short summary of what the server is. + * + */ +export type ServerObjectSummary = string; +/** + * + * The default value to use for substitution, which SHALL be sent if an alternate value is _not_ supplied. Note this behavior is different than the [Schema Object's](#schema-object) treatment of default values, because in those cases parameter values are optional. + * + */ +export type ServerObjectVariableDefault = string; +/** + * + * An optional description for the server variable. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. + * + */ +export type ServerObjectVariableDescription = string; +/** + * + * An enumeration of string values to be used if the substitution options are from a limited set. + * + */ +export type ServerObjectVariableEnumItem = string; +/** + * + * An enumeration of string values to be used if the substitution options are from a limited set. + * + */ +export type ServerObjectVariableEnum = ServerObjectVariableEnumItem[]; +/** + * + * An object representing a Server Variable for server URL template substitution. + * + */ +export interface ServerObjectVariable { + default: ServerObjectVariableDefault; + description?: ServerObjectVariableDescription; + enum?: ServerObjectVariableEnum; + [k: string]: any; +} +/** + * + * A map between a variable name and its value. The value is passed into the [Runtime Expression](#runtime-expression) to produce a server URL. + * + */ +export interface ServerObjectVariables { [key: string]: any; } +/** + * + * A object representing a Server + * + */ +export interface ServerObject { + url: ServerObjectUrl; + name?: ServerObjectName; + description?: ServerObjectDescription; + summary?: ServerObjectSummary; + variables?: ServerObjectVariables; + [regex: string]: SpecificationExtension | any; +} +type AlwaysFalse = any; +/** + * + * An array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](#server-object) with a [url](#server-url) value of `localhost`. + * + */ +export type Servers = ServerObject[]; +/** + * + * The cannonical name for the method. The name MUST be unique within the methods array. + * + */ +export type MethodObjectName = string; +/** + * + * A verbose explanation of the method behavior. GitHub Flavored Markdown syntax MAY be used for rich text representation. + * + */ +export type MethodObjectDescription = string; +/** + * + * A short summary of what the method does. + * + */ +export type MethodObjectSummary = string; +/** + * + * The name of the tag. + * + */ +export type TagObjectName = string; +/** + * + * A verbose explanation for the tag. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. + * + */ +export type TagObjectDescription = string; +/** + * + * Adds metadata to a single tag that is used by the [Method Object](#method-object). It is not mandatory to have a Tag Object per tag defined in the Method Object instances. + * + */ +export interface TagObject { + name: TagObjectName; + description?: TagObjectDescription; + externalDocs?: ExternalDocumentationObject; + [regex: string]: SpecificationExtension | any; +} +export type $Ref = string; +export interface ReferenceObject { + $ref: $Ref; +} +export type TagOrReference = TagObject | ReferenceObject; +/** + * + * A list of tags for API documentation control. Tags can be used for logical grouping of methods by resources or any other qualifier. + * + */ +export type MethodObjectTags = TagOrReference[]; +/** + * + * Format the server expects the params. Defaults to 'either'. + * + * @default either + * + */ +export type MethodObjectParamStructure = "by-position" | "by-name" | "either"; +/** + * + * Name of the content that is being described. If the content described is a method parameter assignable [`by-name`](#method-param-structure), this field SHALL define the parameter's key (ie name). + * + */ +export type ContentDescriptorObjectName = string; +/** + * + * A verbose explanation of the content descriptor behavior. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. + * + */ +export type ContentDescriptorObjectDescription = string; +/** + * + * A short summary of the content that is being described. + * + */ +export type ContentDescriptorObjectSummary = string; +export type $Id = string; +export type $Schema = string; +export type $Comment = string; +export type Title = string; +export type Description = string; +type AlwaysTrue = any; +export type ReadOnly = boolean; +export type Examples = AlwaysTrue[]; +export type MultipleOf = number; +export type Maximum = number; +export type ExclusiveMaximum = number; +export type Minimum = number; +export type ExclusiveMinimum = number; +export type NonNegativeInteger = number; +export type NonNegativeIntegerDefaultZero = number; +export type Pattern = string; +/** + * + * Always valid if true. Never valid if false. Is constant. + * + */ +export type JSONSchemaBoolean = boolean; +/** + * + * @default {} + * + */ +export type JSONSchema = JSONSchemaObject | JSONSchemaBoolean; +export type SchemaArray = JSONSchema[]; +/** + * + * @default true + * + */ +export type Items = JSONSchema | SchemaArray; +export type UniqueItems = boolean; +export type StringDoaGddGA = string; +/** + * + * @default [] + * + */ +export type StringArray = StringDoaGddGA[]; +/** + * + * @default {} + * + */ +export interface Definitions { [key: string]: any; } +/** + * + * @default {} + * + */ +export interface Properties { [key: string]: any; } +export type PropertyNames = any; +/** + * + * @default {} + * + */ +export interface PatternProperties { [key: string]: any; } +export type DependenciesSet = JSONSchema | StringArray; +export interface Dependencies { [key: string]: any; } +export type Enum = AlwaysTrue[]; +export type SimpleTypes = "array" | "boolean" | "integer" | "null" | "number" | "object" | "string"; +export type ArrayOfSimpleTypes = SimpleTypes[]; +export type Type = SimpleTypes | ArrayOfSimpleTypes; +export type Format = string; +export type ContentMediaType = string; +export type ContentEncoding = string; +export interface JSONSchemaObject { + $id?: $Id; + $schema?: $Schema; + $ref?: $Ref; + $comment?: $Comment; + title?: Title; + description?: Description; + default?: AlwaysTrue; + readOnly?: ReadOnly; + examples?: Examples; + multipleOf?: MultipleOf; + maximum?: Maximum; + exclusiveMaximum?: ExclusiveMaximum; + minimum?: Minimum; + exclusiveMinimum?: ExclusiveMinimum; + maxLength?: NonNegativeInteger; + minLength?: NonNegativeIntegerDefaultZero; + pattern?: Pattern; + additionalItems?: JSONSchema; + items?: Items; + maxItems?: NonNegativeInteger; + minItems?: NonNegativeIntegerDefaultZero; + uniqueItems?: UniqueItems; + contains?: JSONSchema; + maxProperties?: NonNegativeInteger; + minProperties?: NonNegativeIntegerDefaultZero; + required?: StringArray; + additionalProperties?: JSONSchema; + definitions?: Definitions; + properties?: Properties; + patternProperties?: PatternProperties; + dependencies?: Dependencies; + propertyNames?: JSONSchema; + const?: AlwaysTrue; + enum?: Enum; + type?: Type; + format?: Format; + contentMediaType?: ContentMediaType; + contentEncoding?: ContentEncoding; + if?: JSONSchema; + then?: JSONSchema; + else?: JSONSchema; + allOf?: SchemaArray; + anyOf?: SchemaArray; + oneOf?: SchemaArray; + not?: JSONSchema; + [k: string]: any; +} +/** + * + * Schema that describes the content. + * + * @default {} + * + */ +export type ContentDescriptorObjectSchema = JSONSchemaObject | JSONSchemaBoolean; +/** + * + * Determines if the content is a required field. Default value is `false`. + * + */ +export type ContentDescriptorObjectRequired = boolean; +/** + * + * Specifies that the content is deprecated and SHOULD be transitioned out of usage. Default value is `false`. + * + */ +export type ContentDescriptorObjectDeprecated = boolean; +/** + * + * Content Descriptors are objects that do just as they suggest - describe content. They are reusable ways of describing either parameters or result. They MUST have a schema. + * + */ +export interface ContentDescriptorObject { + name: ContentDescriptorObjectName; + description?: ContentDescriptorObjectDescription; + summary?: ContentDescriptorObjectSummary; + schema: ContentDescriptorObjectSchema; + required?: ContentDescriptorObjectRequired; + deprecated?: ContentDescriptorObjectDeprecated; + [regex: string]: SpecificationExtension | any; +} +export type ContentDescriptorOrReference = ContentDescriptorObject | ReferenceObject; +/** + * + * A list of parameters that are applicable for this method. The list MUST NOT include duplicated parameters and therefore require [name](#content-descriptor-name) to be unique. The list can use the [Reference Object](#reference-object) to link to parameters that are defined by the [Content Descriptor Object](#content-descriptor-object). All optional params (content descriptor objects with "required": false) MUST be positioned after all required params in the list. + * + */ +export type MethodObjectParams = ContentDescriptorOrReference[]; +/** + * + * The description of the result returned by the method. If defined, it MUST be a Content Descriptor or Reference Object. If undefined, the method MUST only be used as a [notification](https://www.jsonrpc.org/specification#notification) + * + */ +export type MethodObjectResult = ContentDescriptorObject | ReferenceObject; +/** + * + * A Number that indicates the error type that occurred. This MUST be an integer. The error codes from and including -32768 to -32000 are reserved for pre-defined errors. These pre-defined errors SHOULD be assumed to be returned from any JSON-RPC api. + * + */ +export type ErrorObjectCode = number; +/** + * + * A String providing a short description of the error. The message SHOULD be limited to a concise single sentence. + * + */ +export type ErrorObjectMessage = string; +/** + * + * A Primitive or Structured value that contains additional information about the error. This may be omitted. The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.). + * + */ +export type ErrorObjectData = any; +/** + * + * Defines an application level error. + * + */ +export interface ErrorObject { + code: ErrorObjectCode; + message: ErrorObjectMessage; + data?: ErrorObjectData; +} +export type ErrorOrReference = ErrorObject | ReferenceObject; +/** + * + * A list of custom application defined errors that MAY be returned. The Errors MUST have unique error codes. + * + */ +export type MethodObjectErrors = ErrorOrReference[]; +/** + * + * Cannonical name of the link. + * + */ +export type LinkObjectName = any; +/** + * + * Short description for the link. + * + */ +export type LinkObjectSummary = string; +/** + * + * The name of an existing, resolvable OpenRPC method, as defined with a unique `method`. This field MUST resolve to a unique [Method Object](#method-object). As opposed to Open Api, Relative `method` values ARE NOT permitted. + * + */ +export type LinkObjectMethod = string; +/** + * + * A description of the link. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. + * + */ +export type LinkObjectDescription = string; +/** + * + * A map representing parameters to pass to a method as specified with `method`. The key is the parameter name to be used, whereas the value can be a constant or a [runtime expression](#runtime-expression) to be evaluated and passed to the linked method. + * + */ +export type LinkObjectParams = any; +/** + * + * A server object to be used by the target method. + * + */ +export interface LinkObjectServer { + url: ServerObjectUrl; + name?: ServerObjectName; + description?: ServerObjectDescription; + summary?: ServerObjectSummary; + variables?: ServerObjectVariables; + [regex: string]: SpecificationExtension | any; +} +/** + * + * A object representing a Link + * + */ +export type LinkObject = any; +export type LinkOrReference = LinkObject | ReferenceObject; +/** + * + * A list of possible links from this method call. + * + */ +export type MethodObjectLinks = LinkOrReference[]; +/** + * + * Name for the example pairing. + * + */ +export type ExamplePairingObjectName = string; +/** + * + * A verbose explanation of the example pairing. + * + */ +export type ExamplePairingObjectDescription = string; +/** + * + * Short description for the example. + * + */ +export type ExampleObjectSummary = string; +/** + * + * Embedded literal example. The `value` field and `externalValue` field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON, use a string value to contain the example, escaping where necessary. + * + */ +export type ExampleObjectValue = any; +/** + * + * A verbose explanation of the example. [GitHub Flavored Markdown syntax](https://github.github.com/gfm/) MAY be used for rich text representation. + * + */ +export type ExampleObjectDescription = string; +/** + * + * Cannonical name of the example. + * + */ +export type ExampleObjectName = string; +/** + * + * The Example object is an object that defines an example that is intended to match the `schema` of a given [Content Descriptor](#content-descriptor-object). + * + */ +export interface ExampleObject { + summary?: ExampleObjectSummary; + value: ExampleObjectValue; + description?: ExampleObjectDescription; + name: ExampleObjectName; + [regex: string]: SpecificationExtension | any; +} +export type ExampleOrReference = ExampleObject | ReferenceObject; +/** + * + * Example parameters. + * + */ +export type ExamplePairingObjectParams = ExampleOrReference[]; +/** + * + * Example result. When not provided, the example pairing represents usage of the method as a notification. + * + */ +export type ExamplePairingObjectResult = ExampleObject | ReferenceObject; +/** + * + * The Example Pairing object consists of a set of example params and result. The result is what you can expect from the JSON-RPC service given the exact params. + * + */ +export interface ExamplePairingObject { + name: ExamplePairingObjectName; + description?: ExamplePairingObjectDescription; + params: ExamplePairingObjectParams; + result?: ExamplePairingObjectResult; + [k: string]: any; +} +export type ExamplePairingOrReference = ExamplePairingObject | ReferenceObject; +/** + * + * Array of [Example Pairing Objects](#example-pairing-object) where each example includes a valid params-to-result [Content Descriptor](#content-descriptor-object) pairing. + * + */ +export type MethodObjectExamples = ExamplePairingOrReference[]; +/** + * + * Declares this method to be deprecated. Consumers SHOULD refrain from usage of the declared method. Default value is `false`. + * + */ +export type MethodObjectDeprecated = boolean; +/** + * + * Describes the interface for the given method name. The method name is used as the `method` field of the JSON-RPC body. It therefore MUST be unique. + * + */ +export interface MethodObject { + name: MethodObjectName; + description?: MethodObjectDescription; + summary?: MethodObjectSummary; + servers?: Servers; + tags?: MethodObjectTags; + paramStructure?: MethodObjectParamStructure; + params: MethodObjectParams; + result?: MethodObjectResult; + errors?: MethodObjectErrors; + links?: MethodObjectLinks; + examples?: MethodObjectExamples; + deprecated?: MethodObjectDeprecated; + externalDocs?: ExternalDocumentationObject; + [regex: string]: SpecificationExtension | any; +} +export type MethodOrReference = MethodObject | ReferenceObject; +/** + * + * The available methods for the API. While it is required, the array may be empty (to handle security filtering, for example). + * + */ +export type Methods = MethodOrReference[]; +/** + * + * An object to hold reusable [Schema Objects](#schema-object). + * + */ +export interface SchemaComponents { [key: string]: any; } +/** + * + * An object to hold reusable [Link Objects](#link-object). + * + */ +export interface LinkComponents { [key: string]: any; } +/** + * + * An object to hold reusable [Error Objects](#error-object). + * + */ +export interface ErrorComponents { [key: string]: any; } +/** + * + * An object to hold reusable [Example Objects](#example-object). + * + */ +export interface ExampleComponents { [key: string]: any; } +/** + * + * An object to hold reusable [Example Pairing Objects](#example-pairing-object). + * + */ +export interface ExamplePairingComponents { [key: string]: any; } +/** + * + * An object to hold reusable [Content Descriptor Objects](#content-descriptor-object). + * + */ +export interface ContentDescriptorComponents { [key: string]: any; } +/** + * + * An object to hold reusable [Tag Objects](#tag-object). + * + */ +export interface TagComponents { [key: string]: any; } +/** + * + * Holds a set of reusable objects for different aspects of the OpenRPC. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object. + * + */ +export interface Components { + schemas?: SchemaComponents; + links?: LinkComponents; + errors?: ErrorComponents; + examples?: ExampleComponents; + examplePairings?: ExamplePairingComponents; + contentDescriptors?: ContentDescriptorComponents; + tags?: TagComponents; + [k: string]: any; +} +/** + * + * JSON Schema URI (used by some editors) + * + * @default https://meta.open-rpc.org/ + * + */ +export type MetaSchema = string; +export interface OpenrpcDocument { + openrpc: Openrpc; + info: InfoObject; + externalDocs?: ExternalDocumentationObject; + servers?: Servers; + methods: Methods; + components?: Components; + $schema?: MetaSchema; + [regex: string]: SpecificationExtension | any; +} \ No newline at end of file diff --git a/generated/packages/ts/CHANGELOG.md b/generated/packages/ts/CHANGELOG.md new file mode 100644 index 0000000..e69de29 diff --git a/generated/packages/ts/index.d.ts b/generated/packages/ts/index.d.ts new file mode 100644 index 0000000..c461c28 --- /dev/null +++ b/generated/packages/ts/index.d.ts @@ -0,0 +1,4 @@ +import type * as V1_4 from "./1_4/index.js"; +import type * as V1_3 from "./1_3/index.js"; +export type { V1_4, V1_3 }; +export * as spec from "@open-rpc/spec"; diff --git a/generated/packages/ts/index.js b/generated/packages/ts/index.js new file mode 100644 index 0000000..3ced1e2 --- /dev/null +++ b/generated/packages/ts/index.js @@ -0,0 +1 @@ +export * as spec from "@open-rpc/spec"; diff --git a/generated/packages/ts/index.ts b/generated/packages/ts/index.ts new file mode 100644 index 0000000..5f1d33c --- /dev/null +++ b/generated/packages/ts/index.ts @@ -0,0 +1,5 @@ +import type * as V1_4 from "./1_4/index.js"; +import type * as V1_3 from "./1_3/index.js"; + +export type { V1_4, V1_3 } +export * as spec from "@open-rpc/spec"; \ No newline at end of file diff --git a/generated/packages/ts/package.json b/generated/packages/ts/package.json new file mode 100644 index 0000000..c181ba8 --- /dev/null +++ b/generated/packages/ts/package.json @@ -0,0 +1,42 @@ +{ + "name": "@open-rpc/spec-types", + "version": "0.0.0", + "type": "module", + "module": "index.ts", + "scripts": { + "build": "./node_modules/.bin/tsc", + "prepack": "./node_modules/.bin/tsc" + }, + "exports": { + ".": { + "bun": "./index.ts", + "types": "./index.d.ts", + "import": "./index.js", + "default": "./index.js" + }, + "./1_4": { + "bun": "./1_4/index.ts", + "types": "./1_4/index.d.ts", + "import": "./1_4/index.js", + "default": "./1_4/index.js" + }, + "./1_3": { + "bun": "./1_3/index.ts", + "types": "./1_3/index.d.ts", + "import": "./1_3/index.js", + "default": "./1_3/index.js" + } + }, + "dependencies": { + "@open-rpc/spec": "^1.4.0" + }, + "devDependencies": { + "typescript": "^5.0.0" + }, + "files": [ + "**/*.ts", + "**/*.d.ts", + "**/*.js", + "!node_modules" + ] +} \ No newline at end of file diff --git a/generated/packages/ts/tsconfig.json b/generated/packages/ts/tsconfig.json new file mode 100644 index 0000000..d9d94a8 --- /dev/null +++ b/generated/packages/ts/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "ESNext", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "declaration": true, + "emitDeclarationOnly": false, + "strict": true, + "skipLibCheck": true + }, + "include": [ + "./**/*.ts" + ] +} \ No newline at end of file diff --git a/knope.toml b/knope.toml new file mode 100644 index 0000000..7b9f283 --- /dev/null +++ b/knope.toml @@ -0,0 +1,73 @@ +[packages.go] +versioned_files = ["generated/packages/go/go.mod"] +changelog = "generated/packages/go/CHANGELOG.md" +scopes = ["go"] + +[packages.py] +versioned_files = ["generated/packages/py/pyproject.toml"] +changelog = "generated/packages/py/CHANGELOG.md" +scopes = ["py"] + +[packages.rs] +versioned_files = ["generated/packages/rs/Cargo.toml"] +changelog = "generated/packages/rs/CHANGELOG.md" +scopes = ["rs"] + +[packages.ts] +versioned_files = ["generated/packages/ts/package.json"] +changelog = "generated/packages/ts/CHANGELOG.md" +scopes = ["ts"] + +[[workflows]] +name = "prepare-release" + +[[workflows.steps]] +type = "Command" +command = "git switch -c release" + +[[workflows.steps]] +type = "PrepareRelease" + +[[workflows.steps]] +type = "Command" +command = "git commit -m \"chore: prepare release\"" + +[[workflows.steps]] +type = "Command" +command = "git push --force --set-upstream origin release" + +[[workflows.steps]] +type = "CreatePullRequest" +base = "main" + +[workflows.steps.title] +template = "chore: prepare release" +variables = {} + +[workflows.steps.body] +template = "Merging this PR will create a new release. See the diff for version bumps and changelogs." +variables = {} + +[[workflows]] +name = "release" + +[[workflows.steps]] +type = "Release" + +[[workflows]] +name = "document-change" + +[[workflows.steps]] +type = "CreateChangeFile" + +[release_notes] +change_templates = [ + "- $summary ([`$commit_hash`](https://github.com/zcstarr/spec-types/commit/$commit_hash))", + "### $summary\n\n$details", + "- $summary", +] + +[github] +owner = "zcstarr" +repo = "spec-types" + diff --git a/package.json b/package.json new file mode 100644 index 0000000..b2118c4 --- /dev/null +++ b/package.json @@ -0,0 +1,28 @@ +{ + "name": "@open-rpc/spec-types", + "module": "index.ts", + "type": "module", + "scripts": { + "generate": "bun run src/index.ts", + "lint": "bun run eslint ." + }, + "devDependencies": { + "@eslint/js": "^10.0.1", + "@iarna/toml": "^2.2.5", + "@json-schema-tools/dereferencer": "^1.6.3", + "@json-schema-tools/meta-schema": "^1.8.0", + "@types/bun": "latest", + "@types/node": "^25.3.0", + "@typescript-eslint/eslint-plugin": "^8.55.0", + "eslint": "^10.0.0", + "eslint-config-prettier": "^10.1.8", + "eslint-plugin-prettier": "^5.5.5", + "globals": "^17.3.0", + "prettier": "^3.8.1", + "typescript": "^5.9.3" + }, + "dependencies": { + "@json-schema-tools/transpiler": "^1.10.5", + "@open-rpc/spec": "^1.4.0" + } +} \ No newline at end of file diff --git a/prepare_release.yml b/prepare_release.yml new file mode 100644 index 0000000..3b0adcc --- /dev/null +++ b/prepare_release.yml @@ -0,0 +1,27 @@ +name: Create Release PR + +on: + push: + branches: [master] + +jobs: + prepare-release: + if: "!contains(github.event.head_commit.message, 'chore: prepare release')" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.PAT }} + - name: Configure Git + run: | + git config --global user.name "GitHub Actions" + git config --global user.email "github-actions@github.com" + - name: Install Knope + uses: knope-dev/action@v2.1.2 + with: + version: 0.22.3 + - run: knope prepare-release --verbose + env: + GITHUB_TOKEN: ${{ secrets.PAT }} + continue-on-error: true diff --git a/release.yml b/release.yml new file mode 100644 index 0000000..1e87aea --- /dev/null +++ b/release.yml @@ -0,0 +1,32 @@ +name: Release + +on: + pull_request: + types: [closed] + branches: [master] + +jobs: + release: + if: github.head_ref == 'release' && github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install Knope + uses: knope-dev/action@v2.1.2 + with: + version: 0.22.3 + - run: knope release --verbose + env: + GITHUB_TOKEN: ${{ secrets.PAT }} + - uses: actions/setup-node@v4 + with: + node-version: "24" + registry-url: "https://registry.npmjs.org" + - uses: oven-sh/setup-bun@v2 + - run: bun install + - run: bun run build:bundle + - run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/src/assets.ts b/src/assets.ts new file mode 100644 index 0000000..4b6c6a6 --- /dev/null +++ b/src/assets.ts @@ -0,0 +1,127 @@ +export interface PackageJsonOptions { + name: string; + version: string; + dependencies: Record<string, string>; +} + +export interface CargoTomlOptions { + name: string; + version: string; +} + +export const buildCargoToml = ( + schemaNames: string[], + opts: CargoTomlOptions = { name: "@open-rpc/spec-types", version: "0.0.0" }, +): object => ({ + package: { + name: opts.name, + version: opts.version, + edition: "2021", + description: "Generated OpenRPC specification types", + license: "Apache-2.0", + }, + dependencies: { + serde: { version: "1.0", features: ["derive"] }, + serde_json: "1.0", + derive_builder: "0.20", + }, +}); + +export interface GoModOptions { + module: string; + goVersion: string; +} + +export const buildGoMod = ( + opts: GoModOptions = { + module: "github.com/zcstarr/spec-types/generated/packages/go", + goVersion: "1.24.5", + }, + version?: string, +): string => { + const versionComment = version ? ` // ${version}` : ""; + return `module ${opts.module}${versionComment}\n\ngo ${opts.goVersion}\n`; +}; + +export interface PyProjectTomlOptions { + name: string; + version: string; +} + +export const buildPyProjectToml = ( + opts: PyProjectTomlOptions = { + name: "@open-rpc/spec-types", + version: "0.0.0", + }, +): object => ({ + "build-system": { + requires: ["hatchling"], + "build-backend": "hatchling.build", + }, + project: { + name: opts.name, + version: opts.version, + description: "Generated OpenRPC specification types", + license: "Apache-2.0", + "requires-python": ">=3.12", + }, +}); + +export const buildTsConfig = () => ({ + compilerOptions: { + target: "ESNext", + module: "NodeNext", + moduleResolution: "NodeNext", + declaration: true, + emitDeclarationOnly: false, + strict: true, + skipLibCheck: true, + }, + include: ["./**/*.ts"], +}); + +export const buildPackageJson = ( + schemaNames: string[], + opts: PackageJsonOptions = { + name: "@open-rpc/spec-types", + version: "0.0.0", + dependencies: {}, + }, +) => { + const subpathExports = Object.fromEntries( + schemaNames.map((name) => [ + `./${name}`, + { + bun: `./${name}/index.ts`, + types: `./${name}/index.d.ts`, + import: `./${name}/index.js`, + default: `./${name}/index.js`, + }, + ]), + ); + + return { + name: opts.name, + version: opts.version, + type: "module", + module: "index.ts", + scripts: { + build: "./node_modules/.bin/tsc", + prepack: "./node_modules/.bin/tsc", + }, + exports: { + ".": { + bun: "./index.ts", + types: "./index.d.ts", + import: "./index.js", + default: "./index.js", + }, + ...subpathExports, + }, + dependencies: opts.dependencies, + devDependencies: { + typescript: "^5.0.0", + }, + files: ["**/*.ts", "**/*.d.ts", "**/*.js", "!node_modules"], + }; +}; diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..419b67a --- /dev/null +++ b/src/index.ts @@ -0,0 +1,457 @@ +import Transpiler from "@json-schema-tools/transpiler"; +import { compileTypescript } from "./util"; +import { + buildPackageJson, + buildTsConfig, + buildCargoToml, + buildGoMod, + buildPyProjectToml, +} from "./assets.ts"; +import { readFile, writeFile, mkdir, rm } from "fs/promises"; +import Dereferencer from "@json-schema-tools/dereferencer"; +import toml from "@iarna/toml"; +import { getAllSchemas } from "@open-rpc/spec"; +import ts from "typescript"; +import { readFileSync } from "node:fs"; + +interface GetTranspiler { + (name: string): Transpiler; +} + +// Package assets preserved across rebuilds +type Lang = "ts" | "go" | "rs" | "py"; + +interface PackageAssets { + version: string; + changelogContents: string; +} + +type GetPackageAssets = (lang: Lang) => PackageAssets; + +// Operation types for the system +type Op = + | { + type: "write"; + path: string; + content: string; + } + | { + type: "rm"; + path: string; + } + | { + type: "mkdir"; + path: string; + } + | { + type: "compile"; + fileNames: string[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + options: ts.CompilerOptions | any; + lang: Lang; + }; + +// Programatically construct all the assets tomls pyprojects generate them +// then we will use Knope to have the changesets and versions propogated and committed +// this will then allow us to have nice generated assets that can be used in the spec like changesets + +const buildTranspilerCache = async ( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + schemas: Record<string, any>, +): Promise<GetTranspiler> => { + const cache: Record<string, Transpiler> = {}; + for (const [name, schema] of Object.entries(schemas)) { + try { + const dereffer = new Dereferencer(JSON.parse(JSON.stringify(schema))); + const dereffedSchema = await dereffer.resolve(); + cache[name] = new Transpiler(dereffedSchema); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } catch (e: any) { + throw new Error(`Failed to get transpiler for ${name}: ${e.message}`, { + cause: e, + }); + } + } + return (name: string) => { + const transpiler = cache[name]; + if (!transpiler) { + throw new Error(`Transpiler for ${name} not found`); + } + return transpiler; + }; +}; + +// Reads existing versions and changelogs before the generator wipes directories +const buildPackageAssetsCache = async ( + basePath: string, +): Promise<GetPackageAssets> => { + const defaults: PackageAssets = { version: "0.0.0", changelogContents: "" }; + const cache: Record<string, PackageAssets> = {}; + + const tryRead = async (p: string, fallback: string): Promise<string> => { + try { + return await readFile(p, "utf-8"); + } catch { + return fallback; + } + }; + + // ts - read version from package.json + const tsPkg = await tryRead(`${basePath}/ts/package.json`, "{}"); + cache["ts"] = { + version: JSON.parse(tsPkg).version ?? defaults.version, + changelogContents: await tryRead(`${basePath}/ts/CHANGELOG.md`, ""), + }; + + // rs - read version from Cargo.toml + const rsRaw = await tryRead(`${basePath}/rs/Cargo.toml`, ""); + cache["rs"] = { + version: rsRaw + ? // eslint-disable-next-line @typescript-eslint/no-explicit-any + ((toml.parse(rsRaw) as any)?.package?.version ?? defaults.version) + : defaults.version, + changelogContents: await tryRead(`${basePath}/rs/CHANGELOG.md`, ""), + }; + + // py - read version from pyproject.toml + const pyRaw = await tryRead(`${basePath}/py/pyproject.toml`, ""); + cache["py"] = { + version: pyRaw + ? // eslint-disable-next-line @typescript-eslint/no-explicit-any + ((toml.parse(pyRaw) as any)?.project?.version ?? defaults.version) + : defaults.version, + changelogContents: await tryRead(`${basePath}/py/CHANGELOG.md`, ""), + }; + + // go - version stored as comment on module line: `module foo // v1.2.3` + const goModRaw = await tryRead(`${basePath}/go/go.mod`, ""); + const goVersionMatch = goModRaw.match(/^module\s+\S+\s+\/\/\s*(v\S+)/m); + cache["go"] = { + version: goVersionMatch?.[1] ?? "", + changelogContents: await tryRead(`${basePath}/go/CHANGELOG.md`, ""), + }; + + return (lang: Lang): PackageAssets => cache[lang] ?? defaults; +}; + +// Index file generators + +const tsIndexFile = ( + schemaNames: string[], + specPackageName: string, +): string => { + const imports = schemaNames.map( + (name) => `import type * as V${name} from "./${name}/index.js";`, + ); + + const reexport = `export type { ${schemaNames.map((name) => `V${name}`).join(", ")} }`; + const reexportAll = `export * as spec from "${specPackageName}";`; + + return [...imports, "", reexport, reexportAll].join("\n"); +}; + +const rsLibFile = (schemaNames: string[]): string => { + return schemaNames.map((name) => `pub mod v${name};`).join("\n") + "\n"; +}; + +const goPackageFile = ( + name: string, + goCode: string, + rawSchema: string, +): string => { + const escaped = JSON.stringify(rawSchema); + return `package v${name}\n\n${goCode}\n\nconst RawOpenrpcDocument = ${escaped}\n`; +}; + +const pyInitFile = (schemaNames: string[]): string => { + return schemaNames.map((name) => `from . import v${name}`).join("\n") + "\n"; +}; + +const getPackageJsonSpecDependency = ( + packageName: string, +): Record<string, string> => { + const selfPkg = JSON.parse( + readFileSync(new URL("../package.json", import.meta.url), "utf-8"), + ); + const dependencyValue = selfPkg.dependencies?.[packageName]; + if (!dependencyValue) + throw new Error(`${packageName} not found in package.json`); + return { [packageName]: dependencyValue }; +}; +// Operations generators + +const generateTsOp = ( + getTranspiler: GetTranspiler, + schemasNames: string[], + outpath: string, + assets: PackageAssets, +): Op[] => { + const specPackageName = "@open-rpc/spec"; + const deps = getPackageJsonSpecDependency(specPackageName); + const ops: Op[] = [ + { type: "rm", path: `${outpath}` }, + { type: "mkdir", path: outpath }, + ]; + return ops + .concat( + schemasNames.flatMap((name) => { + return [ + { type: "mkdir", path: `${outpath}/${name}` }, + { + type: "write", + path: `${outpath}/${name}/index.ts`, + content: getTranspiler(name).toTs(), + }, + { + type: "write", + path: `${outpath}/index.ts`, + content: tsIndexFile(schemasNames, specPackageName), + }, + ]; + }), + ) + .concat([ + { + type: "write", + path: `${outpath}/package.json`, + content: JSON.stringify( + buildPackageJson(schemasNames, { + name: "@open-rpc/spec-types", + version: assets.version, + dependencies: deps, + }), + null, + 2, + ), + }, + { + type: "write", + path: `${outpath}/tsconfig.json`, + content: JSON.stringify(buildTsConfig(), null, 2), + }, + { + type: "write", + path: `${outpath}/CHANGELOG.md`, + content: assets.changelogContents, + }, + { + type: "compile", + fileNames: [ + `${outpath}/index.ts`, + ...schemasNames.map((name) => `${outpath}/${name}/index.ts`), + ], + options: { + target: ts.ScriptTarget.ES2022, + module: ts.ModuleKind.ES2022, + lib: ["lib.es2022.d.ts"], + moduleResolution: ts.ModuleResolutionKind.Bundler, + declaration: true, + outDir: outpath, + strict: true, + skipLibCheck: true, + }, + lang: "ts", + }, + ]); +}; + +const generateRsOp = ( + getTranspiler: GetTranspiler, + schemasNames: string[], + outpath: string, + assets: PackageAssets, +): Op[] => { + const ops: Op[] = [ + { type: "rm", path: outpath }, + { type: "mkdir", path: outpath }, + { type: "mkdir", path: `${outpath}/src` }, + ]; + + return ops + .concat( + schemasNames.map((name) => ({ + type: "write" as const, + path: `${outpath}/src/v${name}.rs`, + content: getTranspiler(name).toRs(), + })), + ) + .concat([ + { + type: "write", + path: `${outpath}/src/lib.rs`, + content: rsLibFile(schemasNames), + }, + { + type: "write", + path: `${outpath}/Cargo.toml`, + content: toml.stringify( + buildCargoToml(schemasNames, { + name: "open-rpc-spec-types", + version: assets.version, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + }) as any, + ), + }, + { + type: "write", + path: `${outpath}/CHANGELOG.md`, + content: assets.changelogContents, + }, + ]); +}; + +const generateGoOp = ( + getTranspiler: GetTranspiler, + schemasNames: string[], + outpath: string, + assets: PackageAssets, +): Op[] => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const schemas: Record<string, any> = getAllSchemas(); + const ops: Op[] = [ + { type: "rm", path: outpath }, + { type: "mkdir", path: outpath }, + ]; + + return ops + .concat( + schemasNames.flatMap((name) => [ + { type: "mkdir" as const, path: `${outpath}/v${name}` }, + { + type: "write" as const, + path: `${outpath}/v${name}/v${name}.go`, + content: goPackageFile( + name, + getTranspiler(name).toGo(), + JSON.stringify(schemas[name]), + ), + }, + ]), + ) + .concat([ + { + type: "write", + path: `${outpath}/go.mod`, + content: buildGoMod(undefined, assets.version || undefined), + }, + { + type: "write", + path: `${outpath}/CHANGELOG.md`, + content: assets.changelogContents, + }, + ]); +}; + +const generatePyOp = ( + getTranspiler: GetTranspiler, + schemasNames: string[], + outpath: string, + assets: PackageAssets, +): Op[] => { + const pkg = "open_rpc_spec_types"; + const ops: Op[] = [ + { type: "rm", path: outpath }, + { type: "mkdir", path: outpath }, + { type: "mkdir", path: `${outpath}/src/${pkg}` }, + ]; + + return ops + .concat( + schemasNames.map((name) => ({ + type: "write" as const, + path: `${outpath}/src/${pkg}/v${name}.py`, + content: getTranspiler(name).toPy(), + })), + ) + .concat([ + { + type: "write", + path: `${outpath}/src/${pkg}/__init__.py`, + content: pyInitFile(schemasNames), + }, + { + type: "write", + path: `${outpath}/pyproject.toml`, + content: toml.stringify( + buildPyProjectToml({ + name: "open-rpc-spec-types", + version: assets.version, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + }) as any, + ), + }, + { + type: "write", + path: `${outpath}/CHANGELOG.md`, + content: assets.changelogContents, + }, + ]); +}; + +// Interpreter does the actual work +const execute = async (ops: Op[]) => { + for (const op of ops) { + switch (op.type) { + case "write": + await writeFile(op.path, op.content); + break; + case "mkdir": + await mkdir(op.path, { recursive: true }); + break; + case "rm": + await rm(op.path, { recursive: true, force: true }); + break; + case "compile": { + switch (op.lang) { + case "ts": + compileTypescript(op.fileNames, op.options as ts.CompilerOptions); + break; + default: + throw new Error(`Unsupported language: ${op.lang}`); + } + } + } + } +}; + +const run = async () => { + const getTranspiler = await buildTranspilerCache(getAllSchemas()); + const getAssets = await buildPackageAssetsCache("./generated/packages"); + const schemaNames = Object.keys(getAllSchemas()); + + const tsOps = generateTsOp( + getTranspiler, + schemaNames, + "./generated/packages/ts", + getAssets("ts"), + ); + const rsOps = generateRsOp( + getTranspiler, + schemaNames, + "./generated/packages/rs", + getAssets("rs"), + ); + const goOps = generateGoOp( + getTranspiler, + schemaNames, + "./generated/packages/go", + getAssets("go"), + ); + const pyOps = generatePyOp( + getTranspiler, + schemaNames, + "./generated/packages/py", + getAssets("py"), + ); + + await Promise.all([ + execute(tsOps), + execute(rsOps), + execute(goOps), + execute(pyOps), + ]); +}; + +if (import.meta.main) { + run(); +} diff --git a/src/util.ts b/src/util.ts new file mode 100644 index 0000000..a324ec1 --- /dev/null +++ b/src/util.ts @@ -0,0 +1,54 @@ +import * as ts from "typescript"; + +export const StringUtils = { + upperFirst: (str?: string): string => + str ? str.charAt(0).toUpperCase() + str.slice(1) : "", + + camelCase: (str?: string): string => + str + ? str + .toLowerCase() + .replace(/[^a-zA-Z0-9]+(.)/g, (m, chr) => chr.toUpperCase()) + : "", + + snakeCase: (str?: string): string => + str + ? str + .match( + /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g, + )! + .map((x: string) => x.toLowerCase()) + .join("_") + : "", +}; + +export const compileTypescript = ( + fileNames: string[], + options: ts.CompilerOptions, +): void => { + const program = ts.createProgram(fileNames, options); + const emitResult = program.emit(); + + const allDiagnostics = ts + .getPreEmitDiagnostics(program) + .concat(emitResult.diagnostics); + + allDiagnostics.forEach((diagnostic) => { + const message = ts.flattenDiagnosticMessageText( + diagnostic.messageText, + "\n", + ); + // eslint-disable-next-line no-console + console.log(`${diagnostic.file?.fileName}: ${message}`); + }); +}; + +// Usage +/* +compile(['src/index.ts'], { + noEmitOnError: true, + target: ts.ScriptTarget.ESNext, + module: ts.ModuleKind.CommonJS, + outDir: './dist' +}); +*/ diff --git a/test-builds.sh b/test-builds.sh new file mode 100755 index 0000000..7091f7d --- /dev/null +++ b/test-builds.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash +set -euo pipefail + +PACKAGES_DIR="$(cd "$(dirname "$0")/generated/packages" && pwd)" +RESULTS=() + +# --- TypeScript --- +test_ts() { + local tmp=$(mktemp -d) + trap "rm -rf $tmp" RETURN + + cd "$PACKAGES_DIR/ts" + bun install + bun pm pack --destination "$tmp" + + cd "$tmp" + npm init -y > /dev/null 2>&1 + npm install ./open-rpc-spec-types-*.tgz + + node -e "import('@open-rpc/spec-types').then(m => console.log('TS OK:', Object.keys(m)))" +} + +# --- Go --- +test_go() { + local tmp=$(mktemp -d) + trap "rm -rf $tmp" RETURN + cp -r "$PACKAGES_DIR/go/"* "$tmp/" + cd "$tmp" + go build ./... + echo "Go OK" +} + +# --- Python --- + +test_py() { + local tmp=$(mktemp -d) + trap "rm -rf $tmp" RETURN + cp -r "$PACKAGES_DIR/py/"* "$tmp/" + cd "$tmp" + python3.12 -m venv "$tmp/.venv" + "$tmp/.venv/bin/python" -m pip install . --quiet + "$tmp/.venv/bin/python" -c "from open_rpc_spec_types import v1_4; print('Py OK')" +} + +# --- Rust --- +test_rs() { + local tmp=$(mktemp -d) + trap "rm -rf $tmp" RETURN + cp -r "$PACKAGES_DIR/rs/"* "$tmp/" + cd "$tmp" + cargo check 2>&1 + echo "Rust OK" +} + +echo "=== Testing TS ===" && test_ts +echo "=== Testing Go ===" && test_go +# echo "=== Testing Py ===" && test_py +# echo "=== Testing Rs ===" && test_rs + +echo "All install tests passed." \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..7297ff6 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,35 @@ +{ + "compilerOptions": { + // Environment setup & latest features + "lib": [ + "ESNext", + "DOM" + ], + "types": [ + "bun" + ], + "typeRoots": [ + "./node_modules/@types" + ], + "target": "ESNext", + "module": "Preserve", + "moduleDetection": "force", + "jsx": "react-jsx", + "allowJs": true, + // Bundler mode + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true, + // Best practices + "strict": true, + "skipLibCheck": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedIndexedAccess": true, + "noImplicitOverride": true, + // Some stricter flags (disabled by default) + "noUnusedLocals": false, + "noUnusedParameters": false, + "noPropertyAccessFromIndexSignature": false + } +} \ No newline at end of file