Title: Having Role enum name in createUser from swagger fails with error. · Issue #8 · oatpp/example-postgresql · GitHub
Open Graph Title: Having Role enum name in createUser from swagger fails with error. · Issue #8 · oatpp/example-postgresql
X Title: Having Role enum name in createUser from swagger fails with error. · Issue #8 · oatpp/example-postgresql
Description: Hi dear Leo. I have problem with enum in DTO_FIELD in createUser api execution. If i remove the role from request, it works. couldn't figure it out why. Also my db encoding is UTF8 Thanks in advance. Request body: { "username": "string2"...
Open Graph Description: Hi dear Leo. I have problem with enum in DTO_FIELD in createUser api execution. If i remove the role from request, it works. couldn't figure it out why. Also my db encoding is UTF8 Thanks in advanc...
X Description: Hi dear Leo. I have problem with enum in DTO_FIELD in createUser api execution. If i remove the role from request, it works. couldn't figure it out why. Also my db encoding is UTF8 Thanks in ad...
Opengraph URL: https://github.com/oatpp/example-postgresql/issues/8
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Having Role enum name in createUser from swagger fails with error.","articleBody":"Hi dear Leo.\r\nI have problem with enum in DTO_FIELD in createUser api execution.\r\nIf i remove the role from request, it works. couldn't figure it out why.\r\nAlso my db encoding is UTF8\r\nThanks in advance.\r\n\r\nRequest body:\r\n```json\r\n{\r\n \"username\": \"string2\",\r\n \"email\": \"string2\",\r\n \"password\": \"string2\",\r\n \"role\": \"ROLE_GUEST\"\r\n}\r\n```\r\nResponse:\r\n```json\r\n{\r\n \"status\": \"ERROR\",\r\n \"code\": 500,\r\n \"message\": \"ERROR: invalid byte sequence for encoding \\\"UTF8\\\": 0xdd 0xdd\\nCONTEXT: unnamed portal parameter $4\\n\"\r\n}\r\n```\r\nAnd this is my DTO:\r\n\r\n```cpp\r\n#include OATPP_CODEGEN_BEGIN(DTO)\r\n\r\nENUM(Role, v_int32,\r\n VALUE(GUEST, 0, \"ROLE_GUEST\"),\r\n VALUE(ADMIN, 1, \"ROLE_ADMIN\")\r\n)\r\n\r\nclass UserDto : public oatpp::DTO {\r\n \r\n DTO_INIT(UserDto, DTO)\r\n\r\n DTO_FIELD(String, id);\r\n DTO_FIELD(String, userName, \"username\");\r\n DTO_FIELD(String, email, \"email\");\r\n DTO_FIELD(String, password, \"password\");\r\n DTO_FIELD(Enum\u003cRole\u003e::AsString, role, \"role\");\r\n\r\n};\r\n\r\n#include OATPP_CODEGEN_END(DTO)\r\n```\r\nUserDb:\r\n```cpp\r\n QUERY(createUser,\r\n \"INSERT INTO AppUser\"\r\n \"(id, username, email, password, role) VALUES \"\r\n \"(uuid_generate_v4(), :user.username, :user.email, :user.password, :user.role)\"\r\n \"RETURNING *;\",\r\n PREPARE(true), // user prepared statement!\r\n PARAM(oatpp::Object\u003cUserDto\u003e, user))\r\n```","author":{"url":"https://github.com/NoWhereMan1979","@type":"Person","name":"NoWhereMan1979"},"datePublished":"2024-03-12T12:27:06.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/8/example-postgresql/issues/8"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:22513e80-f2a0-db95-4d6a-e8df3c7b6bfb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C97C:A8F1B:1F1EF5:2B968A:698C94AC |
| html-safe-nonce | 8bac5942dc15e695d76c6d9ca6dfb5445dd50506d6bc1b1866d914386a8e204c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOTdDOkE4RjFCOjFGMUVGNToyQjk2OEE6Njk4Qzk0QUMiLCJ2aXNpdG9yX2lkIjoiNzk4OTI0OTAxMDQ0MjIxMjUyNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2e94716e42ea16171731b45307c39c4808faba9ff6ce48bca79461eaeaca75a0 |
| hovercard-subject-tag | issue:2181496228 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/oatpp/example-postgresql/8/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a25230b100cb7edf47e854e93d2d22cc97d7ce51de4095d7f16d10d7189f3ec7/oatpp/example-postgresql/issues/8 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a25230b100cb7edf47e854e93d2d22cc97d7ce51de4095d7f16d10d7189f3ec7/oatpp/example-postgresql/issues/8 |
| og:image:alt | Hi dear Leo. I have problem with enum in DTO_FIELD in createUser api execution. If i remove the role from request, it works. couldn't figure it out why. Also my db encoding is UTF8 Thanks in advanc... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | NoWhereMan1979 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 640eeb7b6ff4d8d106235d228c0c286e82592d4d2403227b5b2b4fc5832297a4 |
| turbo-cache-control | no-preview |
| go-import | github.com/oatpp/example-postgresql git https://github.com/oatpp/example-postgresql.git |
| octolytics-dimension-user_id | 37167448 |
| octolytics-dimension-user_login | oatpp |
| octolytics-dimension-repository_id | 170488350 |
| octolytics-dimension-repository_nwo | oatpp/example-postgresql |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 170488350 |
| octolytics-dimension-repository_network_root_nwo | oatpp/example-postgresql |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3d444f0a47beeeac94cddbb51c91ab408befe8d4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width