-
Notifications
You must be signed in to change notification settings - Fork 35
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: update shared schema spec for consistency #204
Conversation
info: | ||
title: Open Payments - Shared schemas | ||
version: '1.0' | ||
license: | ||
name: Apache 2.0 | ||
identifier: Apache-2.0 | ||
summary: Open Payments - Shared schemas | ||
description: 'Shared schemas used across Open Payments APIs' | ||
contact: | ||
email: tech@interledger.org |
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.
not necessary perse, but just additional information
components: | ||
schemas: |
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.
no changes other than this nesting
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.
related issue:
We can consider reverting this if/when that's resolved.
@wilsonianb yes, that's the one I was looking at, the final response in that issue was a bit different than the earlier one in that thread that was relevant to this change. I hope if there is a change to the library both of those fixes will be addressed. |
There is an open Rafiki PR that generates Typescript types from the Open API spec using the openapi-typescript package.
Whenever type generation script runs, it generates a file with types as such:
The
external
interface is the one that holds references to the types for when an external$ref
is used in a spec (e.g.$ref: ../shared/schemas.yaml#/amount
.However, after the spec split, the type generation for the resource server failed to populate this
external
interface, sinceshared/schemas.yaml
was declaring components directly at the root like:The generator can only populate the external/shared schema interface if using the
components -> schemas
declaration, meaning the shared schema items must be declared like:This PR nests the fields in
openapi/shared/schemas.yaml
to be undercomponents -> schemas
in order to allow type generation to work. If this is too much of a change to support this tool, I might be able to figure out a different (possibly convoluted) solution, but I thought this standardization wouldn't cause issues nor be too much of a stretch.