Changing default case of schema properties
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- typescript
- 領域
- tooling
調査の方向性
Start with config.ts and the ConfigBase type, then trace how generateSchemaTypes and generateFetchers consume schema properties and required names. Decide whether casing belongs in configuration or a generation step, and define the expected behavior for both property and required names. The issue is done when the chosen behavior is implemented consistently and its scope is agreed.
索引モデルが issue の本文から書いたものです。
説明
Hi,
I have a question about changing the case of generated schema properties.
Our OpenApi specification is generated from .NET API. Since all exported object properties have pascal case by default, generated schemas have also pascal, which is not TS/JS convention. It can be solved by these suggestions.
- Changing the case in
config.tsfile. This method is not ideal, but works.
to: async (context) => {
const filenamePrefix = 'api';
const { openAPIDocument: { components } } = context;
for (const schema of Object.values(components?.schemas || {})) {
if (!isSchemaObject(schema)) {
continue;
}
const { properties, required } = schema;
if (properties == null) {
continue;
}
for (const propertyName of Object.keys(properties)) {
const stored = properties[propertyName];
delete properties[propertyName]
properties[_.camelCase(propertyName)] = stored;
}
if (required != null) {
for (let i = 0; i < required.length; i++) {
const propertyName = required[i];
required[i] = _.camelCase(propertyName);
}
}
}
const { schemasFiles } = await generateSchemaTypes(context, {
filenamePrefix,
});
await generateFetchers(context, {
filenamePrefix,
schemasFiles,
});
},
- Adding a new config parameter to override casings. It may look like the example below. I can make a PR for that if necessary.
export type ConfigBase = {
...
filenameCase?: keyof Pick<typeof c, "snake" | "camel" | "kebab" | "pascal">;
casing?: {
schema?: {
property?: keyof Pick<typeof c, "snake" | "camel" | "kebab" | "pascal">;
}
}
};
Which option is better? If none, how should solve this issue?
Thx for your answers.
- 主要言語
- TypeScript
- スター
- 634
- フォーク
- 83
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
fabien0102/openapi-codegen のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
fabien0102/openapi-codegen#343 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
fabien0102/openapi-codegen#342 ·
-
deepMerge mutates its arguments, corrupting request payloads across calls対応中かも @richard-willis-chevin が 44 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
fabien0102/openapi-codegen#349 ·
-
Error when migrating to typesrcipt v7対応中かも @fujikky が 43 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
fabien0102/openapi-codegen#348 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
fabien0102/openapi-codegen#344 ·
fabien0102/openapi-codegen の issue をすべて見る
似ている issue
-
embed: handleTurboSignMessage header comment says the signing page posts to '*' (it never does)オープンdocumentation
難易度 2/5 1時間未満 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 70/100
udistrital/paginaweb_root#23 ·
-
Aborting a request that waits for a socket destroys that socket under a later request (socket hang up)対応中かも @vvo が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
ClickHouse/clickhouse-js#1040 ·
メンテナーはふだん 7 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
Small-tailqwq/dsh-deep-whale#187 ·
メンテナーはふだん 1 日以内に返信
-
Tela Marca manda conferir o campo "Razão social", que em Portugal se chama "Denominação social"オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
melgarafael/DeskcommCRM#2503 ·
メンテナーはふだん 1 日以内に返信