From a7d31256581f2b17c76ce20d715ecb3ae51b8d9b Mon Sep 17 00:00:00 2001 From: Eraxyso <130852025+Eraxyso@users.noreply.github.com> Date: Tue, 12 Nov 2024 11:00:25 +0000 Subject: [PATCH 1/7] fix: combine title and description in QuestionBase into body --- docs/swagger/swagger.yaml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index d3658844..45daecbc 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -684,17 +684,14 @@ components: QuestionBase: type: object properties: - title: - type: string - description: + body: type: string is_required: type: boolean description: | 回答必須かどうか required: - - title - - description + - body - is_required QuestionSettingsByType: oneOf: From 1c73233a5bab12c4f781a9c75ad65c65f33eb1bb Mon Sep 17 00:00:00 2001 From: Eraxyso <130852025+Eraxyso@users.noreply.github.com> Date: Thu, 14 Nov 2024 07:54:17 +0000 Subject: [PATCH 2/7] fix: add discriminator for QuestionSettingsByType --- docs/swagger/swagger.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 45daecbc..94c22e8f 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -701,6 +701,8 @@ components: - $ref: "#/components/schemas/QuestionSettingsSingleChoice" - $ref: "#/components/schemas/QuestionSettingsMultipleChoice" - $ref: "#/components/schemas/QuestionSettingsScale" + discriminator: + propertyName: question_type QuestionSettingsText: allOf: - $ref: "#/components/schemas/QuestionTypeText" From 6eb3498a736bdb97ca61351c12e752f691b94fd5 Mon Sep 17 00:00:00 2001 From: Eraxyso <130852025+Eraxyso@users.noreply.github.com> Date: Thu, 14 Nov 2024 08:06:24 +0000 Subject: [PATCH 3/7] fix: make question_id of Question to be nullable in order to support the addition of questions --- docs/swagger/swagger.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 94c22e8f..7d459f16 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -672,6 +672,8 @@ components: example: 1 question_id: type: integer + description: | + 質問を追加する場合はnull。 example: 1 created_at: type: string @@ -679,7 +681,6 @@ components: example: 2020-01-01T00:00:00+09:00 required: - questionnaire_id - - question_id - created_at QuestionBase: type: object From 85c4c8951c07e73a173a7ea0d1e01d24b39d34ea Mon Sep 17 00:00:00 2001 From: Eraxyso <130852025+Eraxyso@users.noreply.github.com> Date: Thu, 14 Nov 2024 08:07:38 +0000 Subject: [PATCH 4/7] fix: update oapi-codegen files --- openapi/spec.go | 137 ++++++++++++++++++++++++----------------------- openapi/types.go | 129 +++++++++++++++++++++++++------------------- 2 files changed, 144 insertions(+), 122 deletions(-) diff --git a/openapi/spec.go b/openapi/spec.go index 603ecd54..a9d9e9d7 100644 --- a/openapi/spec.go +++ b/openapi/spec.go @@ -18,74 +18,75 @@ import ( // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "H4sIAAAAAAAC/+xc628TyZb/V6ze/QDaDjaBK931t0BGV5GGu0DC7gcSWR27kvRcu9t0twEvipRq8wjE", - "QMQjTAhDCJOBAEPCDCyb4fm/bKUd+9P+C6uqflX1ux0bZkYrIRR316k6dc6vzjl16lRf4IpypSpLQNJU", - "Ln+BqwqKUAEaUMgvWSrXh0oVURJVTRE0UDpSPwZGpBM1oNTx+xJQi4pY1URZ4vJc+8pzY/4ygs3dzbXd", - "xcvtuUsIvkDwOYI/IvgEwYvk74tI1xHcJP8+GzeXjE/3Mvs0pQb285lQQn3BotJ1Y/EF0iF5vozgbwg+", - "sTuZEsoq2I/mdNS4ghp3kf4MNV6gxjyCW+QVmtPHJY7nRMzsGTIHnpOECuDywTPleE4tzoCKgOeq1au4", - "4aQsl4EgcbOzPCE6Vj8J1KosqfFy2TRWHu6+vBM4c0+bnfc/GetLfZ2ty3iSaY4JyjTQRGk6if6R/hk1", - "PiD9V9RoEI5ClBkkiKS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WShs4jxa", - "ShtjSe6L2Jg0fPTWbWQrdbPScVQTtFr4FqTLYsaujNcxlqU/minz1o7+SWwaq+72xktj836/LVv3qOvC", - "7vURdn22goGI24s57Jfx+xqw7LP9ZKSaMLIzLm1YFV1m0VKQlWQr+d0i0JNOcQOW77N3raUrxst7eEdv", - "VkDbW5QkhtbNt/cI7PH5lKDvVSVMw/i/QddXm07VJf4pDLiDtR5Z7OiMiDOaPxHin4VzD2f35R3j5la7", - "8ZFwwdxn6MAbxo331OcFm/Y2zNz9J86yUN8D/D0beKZA58smbNhxw4DvVXBMcsZp38+czJ5WzeHBwZhC", - "fth0K/fhKtIhW7wftwK9soPNPeaEHASQKD7ODzkf32Rqip2PdaY+IjhW795/BLqBvVrzVMe5IafC/uKc", - "9LbfkWlUqj0QIQHfUA1QSwK0ONXHXqBccD81GZkydCMTNlMYkibs2qj6vp2ZMjno45NRRlLj4ojbtjLB", - "xuVQAjnhTUpr45lpLuzreraubHN3OFGU6DBlWx9yO7Xpsz5h9iz3ly7tWYA0Iw2bq8SuURqSFY0IkINM", - "Uv9h+AUdbNrIktJCUDwZBd7O0q/tJ0+7B28MEnsfjzLICUkeuNhJlgzoNXh6HxOmCwiTmc2gnf6XNJvW", - "+FHI+0PYzC9nKuk6IAJPpgLotFmaY9ffTGAsqkA5a2OZZaeqyKVa0fqSJFsiY1W30MU4AVWtZbkolBna", - "fDZLHs7Iqpb/a+6vOZNywpnLhcDPbpO+PZ/D5mYnZv8vAAD//69Dqo+7XwAA", + "H4sIAAAAAAAC/+xc628TyZb/V6ze/QDaDjaBK931t0BGV5GGWSCw+4FEVseuJD3X7jbdbcCLIqXaPAIx", + "JOIRJoRLCJOBAEPCDCyb4fm/bKUd+9P+C6uqflV3V78cG2ZGKyEUd9epOnXOr845depUX+SKcqUqS0DS", + "VC5/kasKilABGlDIL1kq14dKFVESVU0RNFA6Uj8GRqQTNaDU8fsSUIuKWNVEWeLyXPvqc2PuCoLN3c21", + "3cUr7dnLCL5A8Dm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un1ED1", + "D3FaVVllrEvn7mNwZuZ9zMhVdlxWvcvMuiYMVM1OwvQESIFrgjNez6MpNTATAPLB/gDZKqyLgnK4MP3g", + "tp+bdSKrQcLfE8QDk/BBPAJ/M7zfVWQv+q63z5i8lIEGknBlXLveWV6PhOcw6cwP0HRugH2nP8xsJsaD", + "zb0fD6H6DVrBkWGs1UtrpPrmaRqVwk17+GZXyuTZPj44jIXCrjx2nzX1VexCmIvbq9YP5w4nKkpzj0Yt", + "fffD0UV7IUErTqeDzvq11sqbSOh8UxL7iJ3eu7NQ2MR5tJQ2xpLcF7ExafjordvIVupmpeOoJmi18C1I", + "l8WMXRmvY16W/mimzF87+iexaV51tzdeGpv3+23ZukddF3avj7DrsxVkIm4v5rBfxu9rwLLP9tMj1YSR", + "nXF5w6roMouWWFbSW8nvFoGedIobsHyfvWstXTVe3sM7erMC2t6iJDG0br69R2CPz6ewPm2VMA0T/Fxd", + "X206VZf4pzDgDtZ6ZLGjMyLOaMFESHAWzj2c3Zd3jIWtduMj4cJzn6EDbxo331NfImza2zBz9584y0J9", + "OvD3bOA9BTpfNmHjHTcM+H4FxyRnnPb9zMnsadUcHhyMKeSHTbdyH64iHXqL9+NWoF92sLnHnJCDABLF", + "x/kh5zudnppi57ueqY8IjtW79x9MN7BXa57qODfkVDhYnJPe9jsyjUq1MxHC+NwqQy0J0OJUH/uBctH9", + "KmVkytCNTLyZwpA0YddGNfCZzZTJwQCfHmUkNS6OuG0rwzYuhxLICW9SWhvPTHNhX9ezdWWbu8OJokSH", + "Kdv6kNupzYD1CbNnub90ac8Y0ow0bK4Su0ZpSFY0IkBmmaT+w/ALOti0kSWlBVY8GQXeztKv7SdPuwdv", + "DBJ7H496kBOSPHCxkywZ0Gvw9D4mTBcQJjObrJ3+lzSb1vhRyPtD2MwvZyrpOiACT08F0BmzNMeuvxnH", + "WFSBcs7GspedqiKXakXyw18iY1W30MU4jKrWslwUyh7afDZLHk7Lqpb/a+6vOZNy3JnLReYXuknfvi9n", + "czPjM/8XAAD//50rif3mXwAA", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/openapi/types.go b/openapi/types.go index ab4f9a46..e204de8f 100644 --- a/openapi/types.go +++ b/openapi/types.go @@ -5,6 +5,7 @@ package openapi import ( "encoding/json" + "errors" "fmt" "time" @@ -137,11 +138,10 @@ type Groups = []string // NewQuestion defines model for NewQuestion. type NewQuestion struct { - Description string `json:"description"` + Body string `json:"body"` // IsRequired 回答必須かどうか - IsRequired bool `json:"is_required"` - Title string `json:"title"` + IsRequired bool `json:"is_required"` union json.RawMessage } @@ -177,24 +177,24 @@ type NewResponse struct { // Question defines model for Question. type Question struct { - CreatedAt time.Time `json:"created_at"` - Description string `json:"description"` + Body string `json:"body"` + CreatedAt time.Time `json:"created_at"` // IsRequired 回答必須かどうか - IsRequired bool `json:"is_required"` - QuestionId int `json:"question_id"` - QuestionnaireId int `json:"questionnaire_id"` - Title string `json:"title"` + IsRequired bool `json:"is_required"` + + // QuestionId 質問を追加する場合はnull。 + QuestionId *int `json:"question_id,omitempty"` + QuestionnaireId int `json:"questionnaire_id"` union json.RawMessage } // QuestionBase defines model for QuestionBase. type QuestionBase struct { - Description string `json:"description"` + Body string `json:"body"` // IsRequired 回答必須かどうか - IsRequired bool `json:"is_required"` - Title string `json:"title"` + IsRequired bool `json:"is_required"` } // QuestionSettingsByType defines model for QuestionSettingsByType. @@ -862,9 +862,9 @@ func (t NewQuestion) MarshalJSON() ([]byte, error) { } } - object["description"], err = json.Marshal(t.Description) + object["body"], err = json.Marshal(t.Body) if err != nil { - return nil, fmt.Errorf("error marshaling 'description': %w", err) + return nil, fmt.Errorf("error marshaling 'body': %w", err) } object["is_required"], err = json.Marshal(t.IsRequired) @@ -872,11 +872,6 @@ func (t NewQuestion) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("error marshaling 'is_required': %w", err) } - object["title"], err = json.Marshal(t.Title) - if err != nil { - return nil, fmt.Errorf("error marshaling 'title': %w", err) - } - b, err = json.Marshal(object) return b, err } @@ -892,10 +887,10 @@ func (t *NewQuestion) UnmarshalJSON(b []byte) error { return err } - if raw, found := object["description"]; found { - err = json.Unmarshal(raw, &t.Description) + if raw, found := object["body"]; found { + err = json.Unmarshal(raw, &t.Body) if err != nil { - return fmt.Errorf("error reading 'description': %w", err) + return fmt.Errorf("error reading 'body': %w", err) } } @@ -906,13 +901,6 @@ func (t *NewQuestion) UnmarshalJSON(b []byte) error { } } - if raw, found := object["title"]; found { - err = json.Unmarshal(raw, &t.Title) - if err != nil { - return fmt.Errorf("error reading 'title': %w", err) - } - } - return err } @@ -1085,14 +1073,14 @@ func (t Question) MarshalJSON() ([]byte, error) { } } - object["created_at"], err = json.Marshal(t.CreatedAt) + object["body"], err = json.Marshal(t.Body) if err != nil { - return nil, fmt.Errorf("error marshaling 'created_at': %w", err) + return nil, fmt.Errorf("error marshaling 'body': %w", err) } - object["description"], err = json.Marshal(t.Description) + object["created_at"], err = json.Marshal(t.CreatedAt) if err != nil { - return nil, fmt.Errorf("error marshaling 'description': %w", err) + return nil, fmt.Errorf("error marshaling 'created_at': %w", err) } object["is_required"], err = json.Marshal(t.IsRequired) @@ -1100,9 +1088,11 @@ func (t Question) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("error marshaling 'is_required': %w", err) } - object["question_id"], err = json.Marshal(t.QuestionId) - if err != nil { - return nil, fmt.Errorf("error marshaling 'question_id': %w", err) + if t.QuestionId != nil { + object["question_id"], err = json.Marshal(t.QuestionId) + if err != nil { + return nil, fmt.Errorf("error marshaling 'question_id': %w", err) + } } object["questionnaire_id"], err = json.Marshal(t.QuestionnaireId) @@ -1110,11 +1100,6 @@ func (t Question) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("error marshaling 'questionnaire_id': %w", err) } - object["title"], err = json.Marshal(t.Title) - if err != nil { - return nil, fmt.Errorf("error marshaling 'title': %w", err) - } - b, err = json.Marshal(object) return b, err } @@ -1130,17 +1115,17 @@ func (t *Question) UnmarshalJSON(b []byte) error { return err } - if raw, found := object["created_at"]; found { - err = json.Unmarshal(raw, &t.CreatedAt) + if raw, found := object["body"]; found { + err = json.Unmarshal(raw, &t.Body) if err != nil { - return fmt.Errorf("error reading 'created_at': %w", err) + return fmt.Errorf("error reading 'body': %w", err) } } - if raw, found := object["description"]; found { - err = json.Unmarshal(raw, &t.Description) + if raw, found := object["created_at"]; found { + err = json.Unmarshal(raw, &t.CreatedAt) if err != nil { - return fmt.Errorf("error reading 'description': %w", err) + return fmt.Errorf("error reading 'created_at': %w", err) } } @@ -1165,13 +1150,6 @@ func (t *Question) UnmarshalJSON(b []byte) error { } } - if raw, found := object["title"]; found { - err = json.Unmarshal(raw, &t.Title) - if err != nil { - return fmt.Errorf("error reading 'title': %w", err) - } - } - return err } @@ -1184,6 +1162,7 @@ func (t QuestionSettingsByType) AsQuestionSettingsText() (QuestionSettingsText, // FromQuestionSettingsText overwrites any union data inside the QuestionSettingsByType as the provided QuestionSettingsText func (t *QuestionSettingsByType) FromQuestionSettingsText(v QuestionSettingsText) error { + v.QuestionType = "QuestionSettingsText" b, err := json.Marshal(v) t.union = b return err @@ -1191,6 +1170,7 @@ func (t *QuestionSettingsByType) FromQuestionSettingsText(v QuestionSettingsText // MergeQuestionSettingsText performs a merge with any union data inside the QuestionSettingsByType, using the provided QuestionSettingsText func (t *QuestionSettingsByType) MergeQuestionSettingsText(v QuestionSettingsText) error { + v.QuestionType = "QuestionSettingsText" b, err := json.Marshal(v) if err != nil { return err @@ -1210,6 +1190,7 @@ func (t QuestionSettingsByType) AsQuestionSettingsTextLong() (QuestionSettingsTe // FromQuestionSettingsTextLong overwrites any union data inside the QuestionSettingsByType as the provided QuestionSettingsTextLong func (t *QuestionSettingsByType) FromQuestionSettingsTextLong(v QuestionSettingsTextLong) error { + v.QuestionType = "QuestionSettingsTextLong" b, err := json.Marshal(v) t.union = b return err @@ -1217,6 +1198,7 @@ func (t *QuestionSettingsByType) FromQuestionSettingsTextLong(v QuestionSettings // MergeQuestionSettingsTextLong performs a merge with any union data inside the QuestionSettingsByType, using the provided QuestionSettingsTextLong func (t *QuestionSettingsByType) MergeQuestionSettingsTextLong(v QuestionSettingsTextLong) error { + v.QuestionType = "QuestionSettingsTextLong" b, err := json.Marshal(v) if err != nil { return err @@ -1236,6 +1218,7 @@ func (t QuestionSettingsByType) AsQuestionSettingsNumber() (QuestionSettingsNumb // FromQuestionSettingsNumber overwrites any union data inside the QuestionSettingsByType as the provided QuestionSettingsNumber func (t *QuestionSettingsByType) FromQuestionSettingsNumber(v QuestionSettingsNumber) error { + v.QuestionType = "QuestionSettingsNumber" b, err := json.Marshal(v) t.union = b return err @@ -1243,6 +1226,7 @@ func (t *QuestionSettingsByType) FromQuestionSettingsNumber(v QuestionSettingsNu // MergeQuestionSettingsNumber performs a merge with any union data inside the QuestionSettingsByType, using the provided QuestionSettingsNumber func (t *QuestionSettingsByType) MergeQuestionSettingsNumber(v QuestionSettingsNumber) error { + v.QuestionType = "QuestionSettingsNumber" b, err := json.Marshal(v) if err != nil { return err @@ -1262,6 +1246,7 @@ func (t QuestionSettingsByType) AsQuestionSettingsSingleChoice() (QuestionSettin // FromQuestionSettingsSingleChoice overwrites any union data inside the QuestionSettingsByType as the provided QuestionSettingsSingleChoice func (t *QuestionSettingsByType) FromQuestionSettingsSingleChoice(v QuestionSettingsSingleChoice) error { + v.QuestionType = "QuestionSettingsSingleChoice" b, err := json.Marshal(v) t.union = b return err @@ -1269,6 +1254,7 @@ func (t *QuestionSettingsByType) FromQuestionSettingsSingleChoice(v QuestionSett // MergeQuestionSettingsSingleChoice performs a merge with any union data inside the QuestionSettingsByType, using the provided QuestionSettingsSingleChoice func (t *QuestionSettingsByType) MergeQuestionSettingsSingleChoice(v QuestionSettingsSingleChoice) error { + v.QuestionType = "QuestionSettingsSingleChoice" b, err := json.Marshal(v) if err != nil { return err @@ -1288,6 +1274,7 @@ func (t QuestionSettingsByType) AsQuestionSettingsMultipleChoice() (QuestionSett // FromQuestionSettingsMultipleChoice overwrites any union data inside the QuestionSettingsByType as the provided QuestionSettingsMultipleChoice func (t *QuestionSettingsByType) FromQuestionSettingsMultipleChoice(v QuestionSettingsMultipleChoice) error { + v.QuestionType = "QuestionSettingsMultipleChoice" b, err := json.Marshal(v) t.union = b return err @@ -1295,6 +1282,7 @@ func (t *QuestionSettingsByType) FromQuestionSettingsMultipleChoice(v QuestionSe // MergeQuestionSettingsMultipleChoice performs a merge with any union data inside the QuestionSettingsByType, using the provided QuestionSettingsMultipleChoice func (t *QuestionSettingsByType) MergeQuestionSettingsMultipleChoice(v QuestionSettingsMultipleChoice) error { + v.QuestionType = "QuestionSettingsMultipleChoice" b, err := json.Marshal(v) if err != nil { return err @@ -1314,6 +1302,7 @@ func (t QuestionSettingsByType) AsQuestionSettingsScale() (QuestionSettingsScale // FromQuestionSettingsScale overwrites any union data inside the QuestionSettingsByType as the provided QuestionSettingsScale func (t *QuestionSettingsByType) FromQuestionSettingsScale(v QuestionSettingsScale) error { + v.QuestionType = "QuestionSettingsScale" b, err := json.Marshal(v) t.union = b return err @@ -1321,6 +1310,7 @@ func (t *QuestionSettingsByType) FromQuestionSettingsScale(v QuestionSettingsSca // MergeQuestionSettingsScale performs a merge with any union data inside the QuestionSettingsByType, using the provided QuestionSettingsScale func (t *QuestionSettingsByType) MergeQuestionSettingsScale(v QuestionSettingsScale) error { + v.QuestionType = "QuestionSettingsScale" b, err := json.Marshal(v) if err != nil { return err @@ -1331,6 +1321,37 @@ func (t *QuestionSettingsByType) MergeQuestionSettingsScale(v QuestionSettingsSc return err } +func (t QuestionSettingsByType) Discriminator() (string, error) { + var discriminator struct { + Discriminator string `json:"question_type"` + } + err := json.Unmarshal(t.union, &discriminator) + return discriminator.Discriminator, err +} + +func (t QuestionSettingsByType) ValueByDiscriminator() (interface{}, error) { + discriminator, err := t.Discriminator() + if err != nil { + return nil, err + } + switch discriminator { + case "QuestionSettingsMultipleChoice": + return t.AsQuestionSettingsMultipleChoice() + case "QuestionSettingsNumber": + return t.AsQuestionSettingsNumber() + case "QuestionSettingsScale": + return t.AsQuestionSettingsScale() + case "QuestionSettingsSingleChoice": + return t.AsQuestionSettingsSingleChoice() + case "QuestionSettingsText": + return t.AsQuestionSettingsText() + case "QuestionSettingsTextLong": + return t.AsQuestionSettingsTextLong() + default: + return nil, errors.New("unknown discriminator value: " + discriminator) + } +} + func (t QuestionSettingsByType) MarshalJSON() ([]byte, error) { b, err := t.union.MarshalJSON() return b, err From 8462d621802495f122a28726f88f3c2f4a104802 Mon Sep 17 00:00:00 2001 From: Eraxyso <130852025+Eraxyso@users.noreply.github.com> Date: Thu, 14 Nov 2024 12:17:35 +0000 Subject: [PATCH 5/7] Revert "fix: add discriminator for QuestionSettingsByType" This reverts commit 1c73233a5bab12c4f781a9c75ad65c65f33eb1bb. --- docs/swagger/swagger.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 7d459f16..7a241024 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -702,8 +702,6 @@ components: - $ref: "#/components/schemas/QuestionSettingsSingleChoice" - $ref: "#/components/schemas/QuestionSettingsMultipleChoice" - $ref: "#/components/schemas/QuestionSettingsScale" - discriminator: - propertyName: question_type QuestionSettingsText: allOf: - $ref: "#/components/schemas/QuestionTypeText" From 1e969e8e7d231d042f2bd04b9c2defb33bcea810 Mon Sep 17 00:00:00 2001 From: Eraxyso <130852025+Eraxyso@users.noreply.github.com> Date: Thu, 14 Nov 2024 12:17:49 +0000 Subject: [PATCH 6/7] Revert "fix: update oapi-codegen files" This reverts commit 85c4c8951c07e73a173a7ea0d1e01d24b39d34ea. --- openapi/spec.go | 137 +++++++++++++++++++++++------------------------ openapi/types.go | 129 +++++++++++++++++++------------------------- 2 files changed, 122 insertions(+), 144 deletions(-) diff --git a/openapi/spec.go b/openapi/spec.go index a9d9e9d7..603ecd54 100644 --- a/openapi/spec.go +++ b/openapi/spec.go @@ -18,75 +18,74 @@ import ( // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "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MiDOaPxHin4VzD2f35R3j5la7", + "8ZFwwdxn6MAbxo331OcFm/Y2zNz9J86yUN8D/D0beKZA58smbNhxw4DvVXBMcsZp38+czJ5WzeHBwZhC", + "fth0K/fhKtIhW7wftwK9soPNPeaEHASQKD7ODzkf32Rqip2PdaY+IjhW795/BLqBvVrzVMe5IafC/uKc", + "9LbfkWlUqj0QIQHfUA1QSwK0ONXHXqBccD81GZkydCMTNlMYkibs2qj6vp2ZMjno45NRRlLj4ojbtjLB", + "xuVQAjnhTUpr45lpLuzreraubHN3OFGU6DBlWx9yO7Xpsz5h9iz3ly7tWYA0Iw2bq8SuURqSFY0IkINM", + "Uv9h+AUdbNrIktJCUDwZBd7O0q/tJ0+7B28MEnsfjzLICUkeuNhJlgzoNXh6HxOmCwiTmc2gnf6XNJvW", + "+FHI+0PYzC9nKuk6IAJPpgLotFmaY9ffTGAsqkA5a2OZZaeqyKVa0fqSJFsiY1W30MU4AVWtZbkolBna", + "fDZLHs7Iqpb/a+6vOZNywpnLhcDPbpO+PZ/D5mYnZv8vAAD//69Dqo+7XwAA", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/openapi/types.go b/openapi/types.go index e204de8f..ab4f9a46 100644 --- a/openapi/types.go +++ b/openapi/types.go @@ -5,7 +5,6 @@ package openapi import ( "encoding/json" - "errors" "fmt" "time" @@ -138,10 +137,11 @@ type Groups = []string // NewQuestion defines model for NewQuestion. type NewQuestion struct { - Body string `json:"body"` + Description string `json:"description"` // IsRequired 回答必須かどうか - IsRequired bool `json:"is_required"` + IsRequired bool `json:"is_required"` + Title string `json:"title"` union json.RawMessage } @@ -177,24 +177,24 @@ type NewResponse struct { // Question defines model for Question. type Question struct { - Body string `json:"body"` - CreatedAt time.Time `json:"created_at"` + CreatedAt time.Time `json:"created_at"` + Description string `json:"description"` // IsRequired 回答必須かどうか - IsRequired bool `json:"is_required"` - - // QuestionId 質問を追加する場合はnull。 - QuestionId *int `json:"question_id,omitempty"` - QuestionnaireId int `json:"questionnaire_id"` + IsRequired bool `json:"is_required"` + QuestionId int `json:"question_id"` + QuestionnaireId int `json:"questionnaire_id"` + Title string `json:"title"` union json.RawMessage } // QuestionBase defines model for QuestionBase. type QuestionBase struct { - Body string `json:"body"` + Description string `json:"description"` // IsRequired 回答必須かどうか - IsRequired bool `json:"is_required"` + IsRequired bool `json:"is_required"` + Title string `json:"title"` } // QuestionSettingsByType defines model for QuestionSettingsByType. @@ -862,9 +862,9 @@ func (t NewQuestion) MarshalJSON() ([]byte, error) { } } - object["body"], err = json.Marshal(t.Body) + object["description"], err = json.Marshal(t.Description) if err != nil { - return nil, fmt.Errorf("error marshaling 'body': %w", err) + return nil, fmt.Errorf("error marshaling 'description': %w", err) } object["is_required"], err = json.Marshal(t.IsRequired) @@ -872,6 +872,11 @@ func (t NewQuestion) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("error marshaling 'is_required': %w", err) } + object["title"], err = json.Marshal(t.Title) + if err != nil { + return nil, fmt.Errorf("error marshaling 'title': %w", err) + } + b, err = json.Marshal(object) return b, err } @@ -887,10 +892,10 @@ func (t *NewQuestion) UnmarshalJSON(b []byte) error { return err } - if raw, found := object["body"]; found { - err = json.Unmarshal(raw, &t.Body) + if raw, found := object["description"]; found { + err = json.Unmarshal(raw, &t.Description) if err != nil { - return fmt.Errorf("error reading 'body': %w", err) + return fmt.Errorf("error reading 'description': %w", err) } } @@ -901,6 +906,13 @@ func (t *NewQuestion) UnmarshalJSON(b []byte) error { } } + if raw, found := object["title"]; found { + err = json.Unmarshal(raw, &t.Title) + if err != nil { + return fmt.Errorf("error reading 'title': %w", err) + } + } + return err } @@ -1073,14 +1085,14 @@ func (t Question) MarshalJSON() ([]byte, error) { } } - object["body"], err = json.Marshal(t.Body) + object["created_at"], err = json.Marshal(t.CreatedAt) if err != nil { - return nil, fmt.Errorf("error marshaling 'body': %w", err) + return nil, fmt.Errorf("error marshaling 'created_at': %w", err) } - object["created_at"], err = json.Marshal(t.CreatedAt) + object["description"], err = json.Marshal(t.Description) if err != nil { - return nil, fmt.Errorf("error marshaling 'created_at': %w", err) + return nil, fmt.Errorf("error marshaling 'description': %w", err) } object["is_required"], err = json.Marshal(t.IsRequired) @@ -1088,11 +1100,9 @@ func (t Question) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("error marshaling 'is_required': %w", err) } - if t.QuestionId != nil { - object["question_id"], err = json.Marshal(t.QuestionId) - if err != nil { - return nil, fmt.Errorf("error marshaling 'question_id': %w", err) - } + object["question_id"], err = json.Marshal(t.QuestionId) + if err != nil { + return nil, fmt.Errorf("error marshaling 'question_id': %w", err) } object["questionnaire_id"], err = json.Marshal(t.QuestionnaireId) @@ -1100,6 +1110,11 @@ func (t Question) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("error marshaling 'questionnaire_id': %w", err) } + object["title"], err = json.Marshal(t.Title) + if err != nil { + return nil, fmt.Errorf("error marshaling 'title': %w", err) + } + b, err = json.Marshal(object) return b, err } @@ -1115,17 +1130,17 @@ func (t *Question) UnmarshalJSON(b []byte) error { return err } - if raw, found := object["body"]; found { - err = json.Unmarshal(raw, &t.Body) + if raw, found := object["created_at"]; found { + err = json.Unmarshal(raw, &t.CreatedAt) if err != nil { - return fmt.Errorf("error reading 'body': %w", err) + return fmt.Errorf("error reading 'created_at': %w", err) } } - if raw, found := object["created_at"]; found { - err = json.Unmarshal(raw, &t.CreatedAt) + if raw, found := object["description"]; found { + err = json.Unmarshal(raw, &t.Description) if err != nil { - return fmt.Errorf("error reading 'created_at': %w", err) + return fmt.Errorf("error reading 'description': %w", err) } } @@ -1150,6 +1165,13 @@ func (t *Question) UnmarshalJSON(b []byte) error { } } + if raw, found := object["title"]; found { + err = json.Unmarshal(raw, &t.Title) + if err != nil { + return fmt.Errorf("error reading 'title': %w", err) + } + } + return err } @@ -1162,7 +1184,6 @@ func (t QuestionSettingsByType) AsQuestionSettingsText() (QuestionSettingsText, // FromQuestionSettingsText overwrites any union data inside the QuestionSettingsByType as the provided QuestionSettingsText func (t *QuestionSettingsByType) FromQuestionSettingsText(v QuestionSettingsText) error { - v.QuestionType = "QuestionSettingsText" b, err := json.Marshal(v) t.union = b return err @@ -1170,7 +1191,6 @@ func (t *QuestionSettingsByType) FromQuestionSettingsText(v QuestionSettingsText // MergeQuestionSettingsText performs a merge with any union data inside the QuestionSettingsByType, using the provided QuestionSettingsText func (t *QuestionSettingsByType) MergeQuestionSettingsText(v QuestionSettingsText) error { - v.QuestionType = "QuestionSettingsText" b, err := json.Marshal(v) if err != nil { return err @@ -1190,7 +1210,6 @@ func (t QuestionSettingsByType) AsQuestionSettingsTextLong() (QuestionSettingsTe // FromQuestionSettingsTextLong overwrites any union data inside the QuestionSettingsByType as the provided QuestionSettingsTextLong func (t *QuestionSettingsByType) FromQuestionSettingsTextLong(v QuestionSettingsTextLong) error { - v.QuestionType = "QuestionSettingsTextLong" b, err := json.Marshal(v) t.union = b return err @@ -1198,7 +1217,6 @@ func (t *QuestionSettingsByType) FromQuestionSettingsTextLong(v QuestionSettings // MergeQuestionSettingsTextLong performs a merge with any union data inside the QuestionSettingsByType, using the provided QuestionSettingsTextLong func (t *QuestionSettingsByType) MergeQuestionSettingsTextLong(v QuestionSettingsTextLong) error { - v.QuestionType = "QuestionSettingsTextLong" b, err := json.Marshal(v) if err != nil { return err @@ -1218,7 +1236,6 @@ func (t QuestionSettingsByType) AsQuestionSettingsNumber() (QuestionSettingsNumb // FromQuestionSettingsNumber overwrites any union data inside the QuestionSettingsByType as the provided QuestionSettingsNumber func (t *QuestionSettingsByType) FromQuestionSettingsNumber(v QuestionSettingsNumber) error { - v.QuestionType = "QuestionSettingsNumber" b, err := json.Marshal(v) t.union = b return err @@ -1226,7 +1243,6 @@ func (t *QuestionSettingsByType) FromQuestionSettingsNumber(v QuestionSettingsNu // MergeQuestionSettingsNumber performs a merge with any union data inside the QuestionSettingsByType, using the provided QuestionSettingsNumber func (t *QuestionSettingsByType) MergeQuestionSettingsNumber(v QuestionSettingsNumber) error { - v.QuestionType = "QuestionSettingsNumber" b, err := json.Marshal(v) if err != nil { return err @@ -1246,7 +1262,6 @@ func (t QuestionSettingsByType) AsQuestionSettingsSingleChoice() (QuestionSettin // FromQuestionSettingsSingleChoice overwrites any union data inside the QuestionSettingsByType as the provided QuestionSettingsSingleChoice func (t *QuestionSettingsByType) FromQuestionSettingsSingleChoice(v QuestionSettingsSingleChoice) error { - v.QuestionType = "QuestionSettingsSingleChoice" b, err := json.Marshal(v) t.union = b return err @@ -1254,7 +1269,6 @@ func (t *QuestionSettingsByType) FromQuestionSettingsSingleChoice(v QuestionSett // MergeQuestionSettingsSingleChoice performs a merge with any union data inside the QuestionSettingsByType, using the provided QuestionSettingsSingleChoice func (t *QuestionSettingsByType) MergeQuestionSettingsSingleChoice(v QuestionSettingsSingleChoice) error { - v.QuestionType = "QuestionSettingsSingleChoice" b, err := json.Marshal(v) if err != nil { return err @@ -1274,7 +1288,6 @@ func (t QuestionSettingsByType) AsQuestionSettingsMultipleChoice() (QuestionSett // FromQuestionSettingsMultipleChoice overwrites any union data inside the QuestionSettingsByType as the provided QuestionSettingsMultipleChoice func (t *QuestionSettingsByType) FromQuestionSettingsMultipleChoice(v QuestionSettingsMultipleChoice) error { - v.QuestionType = "QuestionSettingsMultipleChoice" b, err := json.Marshal(v) t.union = b return err @@ -1282,7 +1295,6 @@ func (t *QuestionSettingsByType) FromQuestionSettingsMultipleChoice(v QuestionSe // MergeQuestionSettingsMultipleChoice performs a merge with any union data inside the QuestionSettingsByType, using the provided QuestionSettingsMultipleChoice func (t *QuestionSettingsByType) MergeQuestionSettingsMultipleChoice(v QuestionSettingsMultipleChoice) error { - v.QuestionType = "QuestionSettingsMultipleChoice" b, err := json.Marshal(v) if err != nil { return err @@ -1302,7 +1314,6 @@ func (t QuestionSettingsByType) AsQuestionSettingsScale() (QuestionSettingsScale // FromQuestionSettingsScale overwrites any union data inside the QuestionSettingsByType as the provided QuestionSettingsScale func (t *QuestionSettingsByType) FromQuestionSettingsScale(v QuestionSettingsScale) error { - v.QuestionType = "QuestionSettingsScale" b, err := json.Marshal(v) t.union = b return err @@ -1310,7 +1321,6 @@ func (t *QuestionSettingsByType) FromQuestionSettingsScale(v QuestionSettingsSca // MergeQuestionSettingsScale performs a merge with any union data inside the QuestionSettingsByType, using the provided QuestionSettingsScale func (t *QuestionSettingsByType) MergeQuestionSettingsScale(v QuestionSettingsScale) error { - v.QuestionType = "QuestionSettingsScale" b, err := json.Marshal(v) if err != nil { return err @@ -1321,37 +1331,6 @@ func (t *QuestionSettingsByType) MergeQuestionSettingsScale(v QuestionSettingsSc return err } -func (t QuestionSettingsByType) Discriminator() (string, error) { - var discriminator struct { - Discriminator string `json:"question_type"` - } - err := json.Unmarshal(t.union, &discriminator) - return discriminator.Discriminator, err -} - -func (t QuestionSettingsByType) ValueByDiscriminator() (interface{}, error) { - discriminator, err := t.Discriminator() - if err != nil { - return nil, err - } - switch discriminator { - case "QuestionSettingsMultipleChoice": - return t.AsQuestionSettingsMultipleChoice() - case "QuestionSettingsNumber": - return t.AsQuestionSettingsNumber() - case "QuestionSettingsScale": - return t.AsQuestionSettingsScale() - case "QuestionSettingsSingleChoice": - return t.AsQuestionSettingsSingleChoice() - case "QuestionSettingsText": - return t.AsQuestionSettingsText() - case "QuestionSettingsTextLong": - return t.AsQuestionSettingsTextLong() - default: - return nil, errors.New("unknown discriminator value: " + discriminator) - } -} - func (t QuestionSettingsByType) MarshalJSON() ([]byte, error) { b, err := t.union.MarshalJSON() return b, err From 7cbaa2b2e069313ac2ce9ef411f0f115eaf85f02 Mon Sep 17 00:00:00 2001 From: Eraxyso <130852025+Eraxyso@users.noreply.github.com> Date: Thu, 14 Nov 2024 12:18:45 +0000 Subject: [PATCH 7/7] fix: update oapi-codegen files --- openapi/spec.go | 136 +++++++++++++++++++++++------------------------ openapi/types.go | 85 +++++++++++------------------ 2 files changed, 99 insertions(+), 122 deletions(-) diff --git a/openapi/spec.go b/openapi/spec.go index 603ecd54..04cf80a6 100644 --- a/openapi/spec.go +++ b/openapi/spec.go @@ -18,74 +18,74 @@ import ( // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "H4sIAAAAAAAC/+xc628TyZb/V6ze/QDaDjaBK931t0BGV5GGu0DC7gcSWR27kvRcu9t0twEvipRq8wjE", - "QMQjTAhDCJOBAEPCDCyb4fm/bKUd+9P+C6uqflX1ux0bZkYrIRR316k6dc6vzjl16lRf4IpypSpLQNJU", - "Ln+BqwqKUAEaUMgvWSrXh0oVURJVTRE0UDpSPwZGpBM1oNTx+xJQi4pY1URZ4vJc+8pzY/4ygs3dzbXd", - "xcvtuUsIvkDwOYI/IvgEwYvk74tI1xHcJP8+GzeXjE/3Mvs0pQb285lQQn3BotJ1Y/EF0iF5vozgbwg+", - "sTuZEsoq2I/mdNS4ghp3kf4MNV6gxjyCW+QVmtPHJY7nRMzsGTIHnpOECuDywTPleE4tzoCKgOeq1au4", - "4aQsl4EgcbOzPCE6Vj8J1KosqfFy2TRWHu6+vBM4c0+bnfc/GetLfZ2ty3iSaY4JyjTQRGk6if6R/hk1", - "PiD9V9RoEI5ClBkkiKS0/RQNNdk42VSF6XCB7Hy8ixr3yXS2d1c2EVzI7Gs9eG5s3t/99Azr+tEbYxFz", - "dZButj+EMzxUEDuipIFpoBB2ztSAigeXBFEBI8Mj0nFBm/EzhvTHqPEa6b/gQRvzI8OuOKqYwBnT0x/H", - "cwo4UxMVUOLyWGEx7Cj20gjlxIR7OANuD92OPSorWriGtp8g+Lrz6HJm387HB635xda9n1rLOoLN1tIr", - "BO8heDEzzqm1yYqoaaBUELRxjs94mho31812A96GGMz6OkZe4wWCm63vr+ChxjlN1MogoEFn+brZYMBp", - "0Vp501p6FchWRS6JU6IzmKelyxXTLhMGL1VWNAZe/6yAKS7P/VPW9RBZ862aPUkJdwzLHktcBYJSnAmV", - "tVcY6w923zwOY4Z0FYR2VVNEadocb++aLSpASKBXttmfVquUNmdtGhIH/E2Ra1Xyl6iBiuqXNmmQOXXK", - "WsjgvFCpl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mtgWNDAKRy9d9XBv4vgvDBRBkfq", + "6ehH1CFJluoVuaamJiyX5fOiNGWbHZuV1B0dr02URXUalNIRmklTdUgqkTy66rWkpMlRc/swxFgZ/dpq", + "+WBLb2DiMEujKMBvyfvSZXj3558PGisPUWMNNV6jxiJqfOisXNn5cB/BpyRvfQ3pt//n+ysI/jfSbyD4", + "dHf5XXttg6R/VhG8tPPuHdJvGfOrnZUr5OEnBJczicigjuA6JtCbqPHhfz/AWHHQs0ggD00Qy12u4pHh", + "dGhKtZH3gSsV2TErjTak9SR9E567sTPSJfuoLaqb0ypQ1Ih8j7ez8eBSGxkON/u9ygfEImZEmpS/nNXf", + "s/HuDYJSWFr6nGkmXpoRJj6ga1EtCFbrQsVqXlDo9v50+SwxIc32+tXW3VfGykP7sPIpgjeQPh/IxKRO", + "+0Xxk2TyjmNkTpZ+68snNT8bizfs6ex5Fs5ACXh2XSmL5yr9NvKADsGmcfnnztI8gnexdXfOQvc8HZeH", + "BNM5CSqiVPpGwpENe0oKaVEAbhP2EfELY+uTmddEjeeo8ZAcl7xGjWsINlsPrhnXf6OnRk5yn5AD0rf4", + "f9g0tj61f1kjhQJPsd/Tr5P267aW79EFB1bqdBYieBvBTWN2HcEmFpBN3ETwVZCPzizc+bxmSVyft3Ou", + "8TL1CSGBYGlDwBKrZr8vVMCezt33jBcPJ7Ez+1ZUGbFeVZgChYpwgbFUF+faG3M4TLLPw1t3X6XNdKd3", + "1oRstFapCEo9NtXicB8YNlYclKcICIU6zutrBEyPE8swy6UGOLeteKFUAwXMSEETWTA112brwWpneRGv", + "aLIYrYNN/VYH3kT43yrSr3lcD0bwAv6fLEFy+kFVTng6xU3vBc5GeiHBZGKidn3hUjpnNSpM1BOcwo1O", + "CwpwTthpRTI7jNWojfIvE8X//979j7F394WiX3vbJZTLBXt/wwqO7HovbAjcQKBp2YLtOQQ/OzYigz1b", + "hhym3sGE2PD8gPSmVWEHtzKkJMzTIrPP0+3L740H5k6biibglq/n/UkcKs9NC2qh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CncV4RNeA2IQisexthfcj/AAkZ", + "IU09poQ8Ny/w2HapKEuaUCRu07oVpCnCcY7nap4xpkRtujZxoChXsvi9JmqgOJ0VpH+AAU3GfHmxab3I", + "DB0fcRab/+k5oKhm64MHcgdyA7KgHsI9yVUgCVWRy3OH8HMcMAraNBFiNniWMwWYmbKbCM5Z6QG42vph", + "bef9W6Tfar2bJRUxy4O5nfdvd97/tLM9T4yIP5GBGs9x2NqYQ/ot8+KoU26DZnWOMKkQTOCVyf0NaCe8", + "nPGey9IhzsRtkqWvq4U5frq55zZdAgL6KmqC5iG3ehNSht4Kx07MU2cwmMvZILSyD9TqzH6nmks02QW1", + "4OEiAboXGa2XPxrb2wi+sLVqHiN9smqlZvUgFsydi53KpVAww3OHTf6j0de4bDz6BcFN4+Nj48MCgs3d", + "u6/ImdV1sy/c0V9YHfl50W+Fs7+C9NvkJ56H2eOhYI+jJ77FjGyuttearWW9s3QbweYhFU/u7WXMNFy1", + "D8T1ne33CL5ovfyx/WShvbaxu/AJwaZxc9VYeURmT7KlU2qg+oc4raqsMtalc5UxODPzemXkKjsuq95l", + "Zt36BapmJ2F6AqTArb8Zr+fRlBqYCQD5YH+AbBXWRUE5XJh+cNvPzTqR1SDh7wnigUn4IB6Bvxne7yqy", + "F3231WdMXspAA0m4Mq5d7yyvR8JzmHTmB2g6N8C+oh9mNhPjwebej4dQ/Qat4Mgw1uqlNVJ98zSNSuGm", + "PXyzK2XybB8fHMZCYVceu8+a+ip2IczF7VXrh3OHExWluUejlr774eiivZCgFafTQWf9WmvlTSR0vimJ", + "fcRO791ZKGziPFpKG2NJ7ovYmDR89NZtZCt1s9JxVBO0WvgWpMtixq6M1zEvS380U+avHf2T2DSvutsb", + "L43N+/22bN2jrgu710fY9dkKMhG3F3PYL+P3NWDZZ/vpkWrCyM64vGFVdJlFSywr6a3kd4tATzrFDVi+", + "z961lq4aL+/hHb1ZAW1vUZIYWjff3iOwx+dTWF+qSpiGCX59rq82napL/FMYcAdrPbLY0RkRZ7RgIiQ4", + "C+cezu7LO8bCVrvxkXDhuc/QgTeNm++pDws27W2YuftPnGWhvgT4ezbwngKdL5uw8Y4bBny/gmOSM077", + "fuZk9rRqDg8OxhTyw6ZbuQ9XkQ69xftxK9AvO9jcY07IQQCJ4uP8kPPZTU9NsfOZztRHBMfq3fsPphvY", + "qzVPdZwbciocLM5Jb/sdmUal2pkIYXw9laGWBGhxqo/9QLnofmQyMmXoRibeTGFImrBroxr4ambK5GCA", + "T48ykhoXR9y2lWEbl0MJ5IQ3Ka2NZ6a5sK/r2bqyzd3hRFGiw5Rtfcjt1GbA+oTZs9xfurRnDGlGGjZX", + "iV2jNCQrGhEgs0xS/2H4BR1s2siS0gIrnowCb2fp1/aTp92DNwaJvY9HPcgJSR642EmWDOg1eHofE6YL", + "CJOZTdZO/0uaTWv8KOT9IWzmlzOVdB0QgaenAuiMWZpj19+MYyyqQDlnY9nLTlWRS7Ui+eEvkbGqW+hi", + "HEZVa1kuCmUPbT6bJQ+nZVXL/zX315xJOe7M5SLzg9ukb9+HsLmZ8Zn/CwAA///nbjGLtV8AAA==", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/openapi/types.go b/openapi/types.go index ab4f9a46..f033c075 100644 --- a/openapi/types.go +++ b/openapi/types.go @@ -137,11 +137,10 @@ type Groups = []string // NewQuestion defines model for NewQuestion. type NewQuestion struct { - Description string `json:"description"` + Body string `json:"body"` // IsRequired 回答必須かどうか - IsRequired bool `json:"is_required"` - Title string `json:"title"` + IsRequired bool `json:"is_required"` union json.RawMessage } @@ -177,24 +176,24 @@ type NewResponse struct { // Question defines model for Question. type Question struct { - CreatedAt time.Time `json:"created_at"` - Description string `json:"description"` + Body string `json:"body"` + CreatedAt time.Time `json:"created_at"` // IsRequired 回答必須かどうか - IsRequired bool `json:"is_required"` - QuestionId int `json:"question_id"` - QuestionnaireId int `json:"questionnaire_id"` - Title string `json:"title"` + IsRequired bool `json:"is_required"` + + // QuestionId 質問を追加する場合はnull。 + QuestionId *int `json:"question_id,omitempty"` + QuestionnaireId int `json:"questionnaire_id"` union json.RawMessage } // QuestionBase defines model for QuestionBase. type QuestionBase struct { - Description string `json:"description"` + Body string `json:"body"` // IsRequired 回答必須かどうか - IsRequired bool `json:"is_required"` - Title string `json:"title"` + IsRequired bool `json:"is_required"` } // QuestionSettingsByType defines model for QuestionSettingsByType. @@ -862,9 +861,9 @@ func (t NewQuestion) MarshalJSON() ([]byte, error) { } } - object["description"], err = json.Marshal(t.Description) + object["body"], err = json.Marshal(t.Body) if err != nil { - return nil, fmt.Errorf("error marshaling 'description': %w", err) + return nil, fmt.Errorf("error marshaling 'body': %w", err) } object["is_required"], err = json.Marshal(t.IsRequired) @@ -872,11 +871,6 @@ func (t NewQuestion) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("error marshaling 'is_required': %w", err) } - object["title"], err = json.Marshal(t.Title) - if err != nil { - return nil, fmt.Errorf("error marshaling 'title': %w", err) - } - b, err = json.Marshal(object) return b, err } @@ -892,10 +886,10 @@ func (t *NewQuestion) UnmarshalJSON(b []byte) error { return err } - if raw, found := object["description"]; found { - err = json.Unmarshal(raw, &t.Description) + if raw, found := object["body"]; found { + err = json.Unmarshal(raw, &t.Body) if err != nil { - return fmt.Errorf("error reading 'description': %w", err) + return fmt.Errorf("error reading 'body': %w", err) } } @@ -906,13 +900,6 @@ func (t *NewQuestion) UnmarshalJSON(b []byte) error { } } - if raw, found := object["title"]; found { - err = json.Unmarshal(raw, &t.Title) - if err != nil { - return fmt.Errorf("error reading 'title': %w", err) - } - } - return err } @@ -1085,14 +1072,14 @@ func (t Question) MarshalJSON() ([]byte, error) { } } - object["created_at"], err = json.Marshal(t.CreatedAt) + object["body"], err = json.Marshal(t.Body) if err != nil { - return nil, fmt.Errorf("error marshaling 'created_at': %w", err) + return nil, fmt.Errorf("error marshaling 'body': %w", err) } - object["description"], err = json.Marshal(t.Description) + object["created_at"], err = json.Marshal(t.CreatedAt) if err != nil { - return nil, fmt.Errorf("error marshaling 'description': %w", err) + return nil, fmt.Errorf("error marshaling 'created_at': %w", err) } object["is_required"], err = json.Marshal(t.IsRequired) @@ -1100,9 +1087,11 @@ func (t Question) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("error marshaling 'is_required': %w", err) } - object["question_id"], err = json.Marshal(t.QuestionId) - if err != nil { - return nil, fmt.Errorf("error marshaling 'question_id': %w", err) + if t.QuestionId != nil { + object["question_id"], err = json.Marshal(t.QuestionId) + if err != nil { + return nil, fmt.Errorf("error marshaling 'question_id': %w", err) + } } object["questionnaire_id"], err = json.Marshal(t.QuestionnaireId) @@ -1110,11 +1099,6 @@ func (t Question) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("error marshaling 'questionnaire_id': %w", err) } - object["title"], err = json.Marshal(t.Title) - if err != nil { - return nil, fmt.Errorf("error marshaling 'title': %w", err) - } - b, err = json.Marshal(object) return b, err } @@ -1130,17 +1114,17 @@ func (t *Question) UnmarshalJSON(b []byte) error { return err } - if raw, found := object["created_at"]; found { - err = json.Unmarshal(raw, &t.CreatedAt) + if raw, found := object["body"]; found { + err = json.Unmarshal(raw, &t.Body) if err != nil { - return fmt.Errorf("error reading 'created_at': %w", err) + return fmt.Errorf("error reading 'body': %w", err) } } - if raw, found := object["description"]; found { - err = json.Unmarshal(raw, &t.Description) + if raw, found := object["created_at"]; found { + err = json.Unmarshal(raw, &t.CreatedAt) if err != nil { - return fmt.Errorf("error reading 'description': %w", err) + return fmt.Errorf("error reading 'created_at': %w", err) } } @@ -1165,13 +1149,6 @@ func (t *Question) UnmarshalJSON(b []byte) error { } } - if raw, found := object["title"]; found { - err = json.Unmarshal(raw, &t.Title) - if err != nil { - return fmt.Errorf("error reading 'title': %w", err) - } - } - return err }