-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
fix(backend): 虚無ノートを投稿できる問題の修正と api.json
の OpenAPI Specification 3.1.0 への対応
#12969
Changes from all commits
e537f91
e896481
0222508
3d58ca9
a4f47e4
b92c972
d83c01a
dc38118
9930881
5dd8c68
ab15af3
a9ca553
7288851
788072c
a28531b
4499190
b61d7c8
c6c668d
8654589
7c14bbb
0492b12
cb224e6
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 |
---|---|---|
|
@@ -36,7 +36,7 @@ export const paramDef = { | |
untilId: { type: 'string', format: 'misskey:id' }, | ||
folderId: { type: 'string', format: 'misskey:id', nullable: true, default: null }, | ||
type: { type: 'string', nullable: true, pattern: /^[a-zA-Z\/\-*]+$/.toString().slice(1, -1) }, | ||
sort: { type: 'string', nullable: true, enum: ['+createdAt', '-createdAt', '+name', '-name', '+size', '-size'] }, | ||
sort: { type: 'string', nullable: true, enum: ['+createdAt', '-createdAt', '+name', '-name', '+size', '-size', null] }, | ||
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.
|
||
}, | ||
required: [], | ||
} as const; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ import { schemas, convertSchemaToOpenApiSchema } from './schemas.js'; | |
|
||
export function genOpenapiSpec(config: Config) { | ||
const spec = { | ||
openapi: '3.0.0', | ||
openapi: '3.1.0', | ||
|
||
info: { | ||
version: config.version, | ||
|
@@ -56,7 +56,7 @@ export function genOpenapiSpec(config: Config) { | |
} | ||
} | ||
|
||
const resSchema = endpoint.meta.res ? convertSchemaToOpenApiSchema(endpoint.meta.res) : {}; | ||
const resSchema = endpoint.meta.res ? convertSchemaToOpenApiSchema(endpoint.meta.res, 'res') : {}; | ||
|
||
let desc = (endpoint.meta.description ? endpoint.meta.description : 'No description provided.') + '\n\n'; | ||
|
||
|
@@ -71,7 +71,7 @@ export function genOpenapiSpec(config: Config) { | |
} | ||
|
||
const requestType = endpoint.meta.requireFile ? 'multipart/form-data' : 'application/json'; | ||
const schema = { ...endpoint.params }; | ||
const schema = { ...convertSchemaToOpenApiSchema(endpoint.params, 'param') }; | ||
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. OpenAPI Specification 3.1.0 では Footnotes
|
||
|
||
if (endpoint.meta.requireFile) { | ||
schema.properties = { | ||
|
@@ -210,7 +210,9 @@ export function genOpenapiSpec(config: Config) { | |
}; | ||
|
||
spec.paths['/' + endpoint.name] = { | ||
...(endpoint.meta.allowGet ? { get: info } : {}), | ||
...(endpoint.meta.allowGet ? { | ||
get: info, | ||
} : {}), | ||
post: info, | ||
}; | ||
} | ||
|
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.
swagger-cli
は OpenAPI Specification 3.1.0 に対応せず deprecated となり、Redocly CLI への移行が公式に推奨されていた1ので、そちらへの移行作業を行いました。このコマンドは公式ドキュメントに載っていたマイグレーション・ガイド2に基づいています。
Footnotes
https://github.com/APIDevTools/swagger-cli#swaggeropenapi-cli ↩
https://redocly.com/docs/cli/guides/migrate-from-swagger-cli/#migrate-to-redocly-cli-from-swagger-cli ↩
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.
zyoshoka#4 にて validate-api-json が通っているのを確認済みです。