-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
migrate examples to openApi part 13; affects [curseforge date fedora hsts modrinth ore] #9499
Conversation
|
keywords: ['time', 'countdown', 'countup', 'moment'], | ||
documentation, | ||
static openApi = { | ||
'/date/{timestamp}': { |
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'm just now realizing (or perhaps have just forgotten) that I'm not sure if/how we're doing any parameter validation on the frontend badge builder in the new ui 🤔
More of a reminder/edification question, definitely non-blocking
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 think this is the relevant bit of validation:
shields/core/base-service/base.js
Lines 214 to 229 in 9118ba8
// ensure openApi spec matches route | |
if (this.openApi) { | |
const preparedRoute = prepareRoute(this.route) | |
for (const [key, value] of Object.entries(this.openApi)) { | |
let example = key | |
for (const param of value.get.parameters) { | |
example = example.replace(`{${param.name}}`, param.example) | |
} | |
if (!example.match(preparedRoute.regex)) { | |
throw new Error( | |
`Inconsistent Open Api spec and Route found for service ${this.name}`, | |
) | |
} | |
} | |
} | |
} |
Added in #9320 in response to #9320 (comment)
Does that cover what you were thinking of here?
Going to just go ahead and merge this, but feel free to follow up on the comment about validation |
…hsts modrinth ore] (badges#9499) * migrate some services from examples to openApi * improve and de-dupe service titles * improve ore description
Refs #9285
I'm not going to repeat the same blurb. In this one I am still tackling easier cases (all path params) but I'm now moving on to the ones with a description/documentation string of some kind.