Skip to content
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

refactor: Expand schema #7772

Merged
merged 15 commits into from
Sep 11, 2021
Merged

refactor: Expand schema #7772

merged 15 commits into from
Sep 11, 2021

Conversation

tamaina
Copy link
Contributor

@tamaina tamaina commented Sep 5, 2021

Spin off of #7769

Required PR

#7771

What

スキーマは、api-doc(Open Api)においてはobjectのrefが展開(リストからスキーマを取ってきて付け足す)されるが、Misskeyサーバーコード内のTypeScript Typeは展開されることなくunknownになっている。

SchemaをTypeへと変換するSchemaTypeタイプに手を加え、ref参照になっているオブジェクト指定についてpacked型定義を適切に付与する。

Why

#7769 の範囲内での型エラー撲滅。Misskeyサーバー開発をやりやすくする。

@tamaina tamaina marked this pull request as ready for review September 5, 2021 18:35
@tamaina tamaina requested review from rinsuki and mei23 September 5, 2021 18:36
@tamaina
Copy link
Contributor Author

tamaina commented Sep 6, 2021

テストが通らなくなったけどエラーコードを読み解けなかった

@tamaina
Copy link
Contributor Author

tamaina commented Sep 6, 2021

misc/schema.tsでTypeORMをロードする前に呼んでいるのが原因のような気がする

しかし実働環境だとエラー出てないのでなんだかなぁ

@tamaina
Copy link
Contributor Author

tamaina commented Sep 6, 2021

TypeORMを読み込まないシンプルなスキーマインターフェースを定義した

@tamaina
Copy link
Contributor Author

tamaina commented Sep 11, 2021

コンフリクト解消した

@tamaina
Copy link
Contributor Author

tamaina commented Sep 11, 2021

userとnoteの型エラー気になるから直していいかしら

test/utils.ts Outdated Show resolved Hide resolved
@@ -43,7 +43,7 @@ export default class extends Channel {

// 関係ない返信は除外
if (note.reply) {
const reply = note.reply as PackedNote;
const reply = note.reply;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

こういう型注釈消してる変更は、refが展開されるようになったから不要になったってことかな

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

tamaina added a commit to tamaina/misskey that referenced this pull request Sep 11, 2021
@tamaina
Copy link
Contributor Author

tamaina commented Sep 11, 2021

userとnoteの型エラー

直してみた

@syuilo
Copy link
Member

syuilo commented Sep 11, 2021

YOSASOU

@syuilo
Copy link
Member

syuilo commented Sep 11, 2021

テスト確認したらマージする

@syuilo syuilo merged commit 53f3b77 into develop Sep 11, 2021
@syuilo syuilo deleted the expand-schema branch September 11, 2021 16:12
@syuilo
Copy link
Member

syuilo commented Sep 11, 2021

👍👍👍

syuilo pushed a commit that referenced this pull request Sep 22, 2021
* packedNotificationSchemaを更新

* read:gallery, write:gallery, read:gallery-likes, write:gallery-likesに翻訳を追加

* fix

* add header, choice, invitation

* test

* fix

* yatta

* remove no longer needed "as PackedUser/PackedNote"

* clean up

* add simple-schema

* fix lint

* define items in full Schema

* revert #7772 (comment)

* user packとnote packの型不整合を修正

* add prelude/types.ts

* emoji

* signin

* game

* matching

* fix

* add emoji schema

* add reversiGame

* add reversiMatching

* remove signin schema (use Signin entity)

* add Packed type

* note-reaction

* user

* user-group

* user-list

* note

* app, messaging-message

* notification

* drive-file

* drive-folder

* following

* muting

* blocking

* hashtag

* page

* app (with modifying schema)

* import user?

* channel

* antenna

* clip

* gallery-post

* emoji

* Packed

* reversi-matching

* add changelog

* add changelog

* revert fix
snk-lab pushed a commit to snk-lab/misskey-kusa-note that referenced this pull request Sep 24, 2021
* packedNotificationSchemaを更新

* read:gallery, write:gallery, read:gallery-likes, write:gallery-likesに翻訳を追加

* fix

* add header, choice, invitation

* test

* fix

* yatta

* remove no longer needed "as PackedUser/PackedNote"

* clean up

* add simple-schema

* fix lint

* define items in full Schema

* revert misskey-dev#7772 (comment)

* user packとnote packの型不整合を修正
snk-lab pushed a commit to snk-lab/misskey-kusa-note that referenced this pull request Sep 24, 2021
* packedNotificationSchemaを更新

* read:gallery, write:gallery, read:gallery-likes, write:gallery-likesに翻訳を追加

* fix

* add header, choice, invitation

* test

* fix

* yatta

* remove no longer needed "as PackedUser/PackedNote"

* clean up

* add simple-schema

* fix lint

* define items in full Schema

* revert misskey-dev#7772 (comment)

* user packとnote packの型不整合を修正

* add prelude/types.ts

* emoji

* signin

* game

* matching

* fix

* add emoji schema

* add reversiGame

* add reversiMatching

* remove signin schema (use Signin entity)

* add Packed type

* note-reaction

* user

* user-group

* user-list

* note

* app, messaging-message

* notification

* drive-file

* drive-folder

* following

* muting

* blocking

* hashtag

* page

* app (with modifying schema)

* import user?

* channel

* antenna

* clip

* gallery-post

* emoji

* Packed

* reversi-matching

* add changelog

* add changelog

* revert fix
syuilo pushed a commit that referenced this pull request Oct 20, 2021
* wip

* wip

* wip

* ✌️

* add main stream

* packedNotificationSchemaを更新

* read:gallery, write:gallery, read:gallery-likes, write:gallery-likesに翻訳を追加

* fix

* ok

* add header, choice, invitation

* add header, choice, invitation

* test

* fix

* fix

* yatta

* remove no longer needed "as PackedUser/PackedNote"

* clean up

* add simple-schema

* fix lint

* fix lint

* wip

* wip!

* wip

* fix

* wip

* wip

* ✌️

* 送信側に型エラーがないことを3回確認した

* ✌️

* wip

* update typescript

* define items in full Schema

* edit comment

* edit comment

* edit comment

* Update src/prelude/types.ts

Co-authored-by: Acid Chicken (硫酸鶏) <[email protected]>

* #7769 (comment)

* user packとnote packの型不整合を修正

* revert #7772 (comment)

* revert #7772 (comment)

* user packとnote packの型不整合を修正

* add prelude/types.ts

* emoji

* signin

* game

* matching

* clean up

* ev => data

* refactor

* clean up

* add type

* antenna

* channel

* fix

* add Packed type

* add PackedRef

* fix lint

* add emoji schema

* add reversiGame

* add reversiMatching

* remove signin schema (use Signin entity)

* add schemas refs, fix Packed type

* wip PackedHoge => Packed<'Hoge'>

* add Packed type

* note-reaction

* user

* user-group

* user-list

* note

* app, messaging-message

* notification

* drive-file

* drive-folder

* following

* muting

* blocking

* hashtag

* page

* app (with modifying schema)

* import user?

* channel

* antenna

* clip

* gallery-post

* emoji

* Packed

* reversi-matching

* update stream.ts

* #7769 (comment)

* fix lint

* clean up?

* add changelog

* add changelog

* add changelog

* fix: アンテナが既読にならないのを修正

* revert fix

* #7769 (comment)

* spec => payload

* edit commetn

Co-authored-by: Acid Chicken (硫酸鶏) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants