Repository navigation
feat: generate sigarra sdk from openapi spec #814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
5394bcd
feat: use fern to generate sigarra sdk
limwa 00b1113
feat(sigarra): document sigarra endpoints and authentication
limwa 6ab3c5b
chore(sigarra): generate sdk
limwa ad72a04
docs(sigarra): drop TTS attribution from the spec
limwa 1e12171
chore(sigarra): regenerate sdk
limwa f22ceea
fix: anonymize data
limwa 19fb3a2
fix(sigarra): regenerate sdk after anonymizing spec
limwa 7b4981e
refactor(sigarra): use english kebab-case operation ids
limwa efef044
docs(sigarra): tag openapi operations
limwa 3964e8d
fix(sigarra): disable implicit retries
limwa 595669e
ci: typecheck sigarra package
limwa a00bcd2
docs: document sigarra package
limwa 65e7e4f
Merge remote-tracking branch 'origin/monorepo' into t3code/sigarra-sd…
limwa 4a209c8
Merge remote-tracking branch 'origin/beta' into t3code/sigarra-sdk-fo…
limwa 9546526
docs(sigarra): translate OpenAPI summaries and descriptions to English
limwa 90d657e
ci(sigarra): check generated SDK is up to date on PRs
limwa fbee71d
ci(sigarra): run generated SDK check on drafts and bump actions
limwa f02fd2b
chore: ignore generated sigarra sdk in oxfmt
limwa 8364db7
chore(sigarra): regenerate sdk
limwa 55d70ac
fix(sigarra): tighten spec per review
limwa 7484c86
docs(sigarra): drop the generating section from the package README
limwa 15f655a
chore(sigarra): regenerate sdk
limwa 0a6667f
docs(sigarra): document SDK generation workflow
limwa 52fa83f
fix(sigarra): patch the passthrough retry default doc
limwa 8de52d5
chore(sigarra): align typescript with the workspace
limwa 633dc99
refactor(sigarra): share the faculty and language path parameters
limwa 5c1d76c
chore: mark the generated sigarra sdk as generated
limwa d526ee2
docs(sigarra): show how to authenticate with session cookies
limwa b9b4746
chore(sigarra): regenerate sdk
limwa e25f5d5
docs: document the sigarra package in AGENTS.md
limwa 2d46e6c
fix(sigarra): use examples for the faculty and language parameters
limwa 1d50a6c
docs(sigarra): note which endpoints accept sessions from any IP
limwa bea5eca
chore(sigarra): regenerate sdk
limwa e31c92b
ci(sigarra): give the generation job a read-only token
limwa 9658b5e
refactor(sigarra): remove the redirect-only FEUP entry point
limwa 7b2e46b
chore(sigarra): regenerate sdk
limwa be22d02
ci: change name of sdk job
limwa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| node_modules |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # @tts/sigarra | ||
|
|
||
| TypeScript SDK for [SIGARRA](https://sigarra.up.pt), generated from [`openapi.json`](./openapi.json) with [Fern](https://buildwithfern.com). | ||
|
|
||
| ```ts | ||
| import { SigarraClient } from '@tts/sigarra' | ||
|
|
||
| const sigarra = new SigarraClient() | ||
| await sigarra.feup.home() | ||
| ``` | ||
|
|
||
| ## Generating | ||
|
|
||
| The generated SDK is committed under `src/generated`. After changing `openapi.json` or `fern/generators.yml`, regenerate it with: | ||
|
|
||
| ```sh | ||
| bun run generate | ||
| ``` | ||
|
|
||
| This runs `fern generate --local` and then `scripts/patch-generated.ts`, which fixes a type error in Fern's generated `Headers.ts`. Fern needs Docker (the Fern TypeScript generator runs in a container) and `node`. With Podman, unqualified image names such as `fernapi/fern-typescript-sdk` must resolve to Docker Hub; if they don't, point `CONTAINERS_REGISTRIES_CONF` to a file containing `unqualified-search-registries = ["docker.io"]`. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "organization": "niaefeup", | ||
| "version": "5.144.3" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json | ||
| # | ||
| # Output paths are relative to this file. | ||
| api: | ||
| specs: | ||
| - openapi: ../openapi.json | ||
| overrides: ./openapi-overrides.yml | ||
| default-group: typescript-sdk | ||
| groups: | ||
| typescript-sdk: | ||
| generators: | ||
| - name: fernapi/fern-typescript-sdk | ||
| version: 3.98.4 | ||
| output: | ||
| location: local-file-system | ||
| path: ../src/generated | ||
| config: | ||
| namespaceExport: Sigarra |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Fern-only adjustments; openapi.json stays the accurate description of SIGARRA. | ||
| # | ||
| # Fern can't generate cookie API keys (SI_SESSION / SI_SECURITY): it ignores them | ||
| # and makes every endpoint require the only scheme left, uportoOidc. So, for the | ||
| # SDK, drop authentication altogether (pass the session cookies through the | ||
| # client's `headers` option) and give auth.oidcToken its token as a plain header. | ||
| # | ||
| # Endpoints whose session is optional declare `security` explicitly in | ||
| # openapi.json, so they must be cleared here as well. | ||
| security: [] | ||
| components: | ||
| securitySchemes: | ||
| uportoOidc: null | ||
| paths: | ||
| /auth/oidc/token: | ||
| get: | ||
| security: [] | ||
| parameters: | ||
| - name: Authorization | ||
| in: header | ||
| required: true | ||
| description: "`Bearer <access token>`." | ||
| schema: | ||
| type: string | ||
| /{faculty}/{language}/web_page.inicial: | ||
| get: | ||
| security: [] | ||
| /{faculty}/{language}/func_geral.formview: | ||
| get: | ||
| security: [] | ||
| /{faculty}/{language}/fotografias_service.foto: | ||
| get: | ||
| security: [] | ||
| /{faculty}/{language}/vld_validacao.sair: | ||
| get: | ||
| security: [] | ||
| /{faculty}/{language}/ucurr_geral.ficha_uc_view: | ||
| get: | ||
| security: [] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.