Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Allow custom Dtos for endpoints

オープン
#75 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
30/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
csharp
領域
api, backend

調査の方向性

MapInstantAPIs の構成エントリポイントから開始し、エンティティ型がエンドポイントのリクエストモデルになるまでを追跡します。要求された AddFoodDto/UseCustomDto の insert フローと、生成された Swagger の body を比較します。完了条件は、呼び出し元がエンドポイントにカスタム DTO を渡し、それが要求どおりエンティティにマッピングされることです。

索引モデルが issue の本文から書いたものです。

説明

Suppose I have this class

`
public class Food : Record
{

    public string Name { get; set; }
    public decimal Portion { get; set; }
    public decimal Calories { get; set; }
    public decimal Carbohydrates { get; set; }
    public decimal Lipids { get; set; }
    public decimal Proteins { get; set; }
    public decimal Fiber { get; set; }
    
    public Guid SourceId { get; set; }
    public Source Source { get; set; }

    public Classification Classification { get; set; }
    public NewClassification NewClassification { get; set; }

    public ICollection<FoodRecipes> FoodRecipes { get; set; }

}
`

When using InstantAPIs, the following swagger body model is created

{ "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "registration": "2023-09-04T02:26:10.760Z", "update": "2023-09-04T02:26:10.760Z", "deletion": "2023-09-04T02:26:10.760Z", "name": "string", "portion": 0, "calories": 0, "carbohydrates": 0, "lipids": 0, "proteins": 0, "fiber": 0, "sourceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "source": { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "registration": "2023-09-04T02:26:10.760Z", "update": "2023-09-04T02:26:10.760Z", "deletion": "2023-09-04T02:26:10.760Z", "name": "string" }, "classification": 0, "newClassification": 0, "foodRecipes": [ { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "registration": "2023-09-04T02:26:10.760Z", "update": "2023-09-04T02:26:10.760Z", "deletion": "2023-09-04T02:26:10.760Z", "recipeId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "recipe": { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "registration": "2023-09-04T02:26:10.760Z", "update": "2023-09-04T02:26:10.760Z", "deletion": "2023-09-04T02:26:10.760Z", "name": "string", "foodRecipes": [ "string" ] }, "foodId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "food": "string" } ] }

I wish there would be a way to provide custom DTOs and maybe using AutoMapper to transforming to entity class, like

app.MapInstantAPIs<EuNutroContext>(config => { config.ExcludeTable(db => db.AnyTable); config.UseCustomDto(db => db.Food, typeof(AddFoodDto), ApiMethodsToGenerate.Insert); // like this });

主要言語
C#
スター
453
フォーク
58
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

csharpfritz/InstantAPIs のほかの issue

csharpfritz/InstantAPIs の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。