-
Notifications
You must be signed in to change notification settings - Fork 90
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
chore(backend): update OpenAPI specs #799
Changes from 1 commit
695817d
e568995
927c322
bb4be91
faee3cb
30a33e6
0c3c90a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,5 @@ build | |
.env | ||
src/coverage | ||
tmp | ||
/src/openapi/resource-server.yaml | ||
/src/openapi/schemas.yaml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
## https://stackoverflow.com/questions/59895/how-do-i-get-the-directory-where-a-bash-script-is-located-from-within-the-script | ||
SOURCE=${BASH_SOURCE[0]} | ||
while [ -L "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink | ||
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd ) | ||
SOURCE=$(readlink "$SOURCE") | ||
[[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located | ||
done | ||
OUTDIR=$( cd -P "$( dirname "$SOURCE" )/../src/openapi" >/dev/null 2>&1 && pwd ) | ||
|
||
curl -o "$OUTDIR/resource-server.yaml" https://raw.githubusercontent.com/interledger/open-payments/b363d33038fe789e5388f04f80ddd06a4fa97093/openapi/resource-server.yaml | ||
curl -o "$OUTDIR/schemas.yaml" https://raw.githubusercontent.com/interledger/open-payments/b363d33038fe789e5388f04f80ddd06a4fa97093/openapi/schemas.yaml | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we also update the or would it make sense to export these from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could even do it for both of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I'm favor of defining the (default) commit in a single place.
Did you mean |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import { EventEmitter } from 'events' | ||
import { Server } from 'http' | ||
import path from 'path' | ||
import createLogger from 'pino' | ||
import { knex } from 'knex' | ||
import { Model } from 'objection' | ||
|
@@ -109,13 +110,17 @@ export function initIocContainer( | |
replica_addresses: config.tigerbeetleReplicaAddresses | ||
}) | ||
}) | ||
container.singleton('openApi', async (deps) => { | ||
const config = await deps.use('config') | ||
return await createOpenAPI(config.openPaymentsSpec) | ||
}) | ||
container.singleton('authOpenApi', async (deps) => { | ||
const config = await deps.use('config') | ||
return await createOpenAPI(config.authServerSpec) | ||
container.singleton('openApi', async () => { | ||
const authServerSpec = await createOpenAPI( | ||
path.resolve(__dirname, './openapi/auth-server.yaml') | ||
) | ||
const resourceServerSpec = await createOpenAPI( | ||
path.resolve(__dirname, './openapi/resource-server.yaml') | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we add a good error message here, for when the files can't be found? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As is, we get something like
Are you thinking of having it mention the command to fetch the schemas? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that's what I was thinking, something along the lines of "Could not find Open API schema files. Did you run There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As long we remember not to change the command 😅 |
||
return { | ||
authServerSpec, | ||
resourceServerSpec | ||
} | ||
}) | ||
container.singleton('openPaymentsClient', async (deps) => { | ||
const config = await deps.use('config') | ||
|
@@ -170,10 +175,11 @@ export function initIocContainer( | |
}) | ||
container.singleton('authService', async (deps) => { | ||
const config = await deps.use('config') | ||
const { authServerSpec } = await deps.use('openApi') | ||
return await createAuthService({ | ||
logger: await deps.use('logger'), | ||
authServerIntrospectionUrl: config.authServerIntrospectionUrl, | ||
authOpenApi: await deps.use('authOpenApi') | ||
authServerSpec | ||
}) | ||
}) | ||
container.singleton('paymentPointerService', async (deps) => { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../auth/src/openapi/resource-server.yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a root level command?
"localenv:fetch-op-schemas": "pnpm --filter auth --filter backend fetch-schemas"
, and then include it as part of the local env setup readme?https://interledgerfoundation.slack.com/archives/C0302LMKBT7/p1670414356297499?thread_ts=1670407497.730339&cid=C0302LMKBT7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking that devs would run through this environment setup before doing local env, but I guess that's not entirely necessary.
https://github.com/interledger/rafiki#environment-setup
Should we split out installing node & pnpm and fetching schemas into a separate prerequisite section?
I also noticed that as is it shouldn't work to have tests before fetch schemas.