Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: Add support for json omitempty and embedded structs in apitypings#1318

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

mafredri
Copy link
Member

Note: This PR targets#1308, it is a continuation but I felt it warranted a separate PR.

This PR adds support for the JSONomitempty tag (reflected as a TypeScript optional) and embedded structs in thecodersdk package. The properties of embedded structs now appear directly on the struct that embeds them via TypeScriptinterface .. extends. This behaves the same way as the Gojson.Marshal andjson.Unmarshal do when a struct is embedded (example playground).

As discussed in#1308 (comment), the generated typings are not ideal for comfortable use in the frontend, this tries to amend that.

If we don't want the above behavior, the field can either be named or a havejson tag added.

Do these changes seem reasonable/are they helpful@presleyp@BrunoQuaresma?

@mafredrimafredri requested a review froma team as acode ownerMay 6, 2022 09:26
@mafredrimafredri self-assigned thisMay 6, 2022
@mafredrimafredri requested review fromBrunoQuaresma,presleyp anda teamMay 6, 2022 09:26
@codecov
Copy link

codecovbot commentedMay 6, 2022
edited
Loading

Codecov Report

Merging#1318 (3650ed7) intomafredri/feat-paginate-template-versions-endpoint (13fc406) willdecrease coverage by10.25%.
The diff coverage is0.00%.

@@                                  Coverage Diff                                   @@##           mafredri/feat-paginate-template-versions-endpoint    #1318       +/-   ##======================================================================================- Coverage                                              66.78%   56.52%   -10.26%======================================================================================  Files                                                    282      152      -130       Lines                                                  18471    16624     -1847       Branches                                                 235        0      -235     ======================================================================================- Hits                                                   12335     9397     -2938- Misses                                                  4866     6128     +1262+ Partials                                                1270     1099      -171
FlagCoverage Δ
unittest-go-macos-latest54.01% <0.00%> (-0.08%)⬇️
unittest-go-postgres-?
unittest-go-ubuntu-latest56.44% <0.00%> (?)
unittest-js?
Impacted FilesCoverage Δ
codersdk/pagination.go100.00% <ø> (ø)
scripts/apitypings/main.go0.00% <0.00%> (ø)
coderd/devtunnel/tunnel.go0.00% <0.00%> (-79.67%)⬇️
coderd/database/queries.sql.go0.00% <0.00%> (-77.91%)⬇️
coderd/database/pubsub.go0.00% <0.00%> (-77.78%)⬇️
coderd/database/db.go0.00% <0.00%> (-55.18%)⬇️
coderd/database/migrate.go0.00% <0.00%> (-45.00%)⬇️
cli/config/file.go67.64% <0.00%> (-8.83%)⬇️
coderd/coderdtest/coderdtest.go93.73% <0.00%> (-5.13%)⬇️
cli/server.go53.87% <0.00%> (-3.62%)⬇️
... and139 more

Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last update13fc406...3650ed7. Read thecomment docs.

Copy link
Contributor

@presleyppresleyp left a comment

Choose a reason for hiding this comment

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

This looks great, thanks!

@mafredrimafredriforce-pushed themafredri/feat-paginate-template-versions-endpoint branch from04b3b1f to13fc406CompareMay 10, 2022 07:30
@mafredrimafredriforce-pushed themafredri/feat-improve-generated-typings branch fromccade36 to3650ed7CompareMay 10, 2022 07:33
@mafredrimafredri merged commitaab400c intomafredri/feat-paginate-template-versions-endpointMay 10, 2022
@mafredrimafredri deleted the mafredri/feat-improve-generated-typings branchMay 10, 2022 07:36
mafredri added a commit that referenced this pull requestMay 10, 2022
…1308)* feat: Implement pagination for template versions* feat: Use unified pagination between users and template versions* Sync codepaths between users and template versions* Create requestOption type in codersdk and add test* Fix created_at edge case for pagination cursor in queries* feat: Add support for json omitempty and embedded structs in apitypings (#1318)* Add scripts/apitypings/main.go to Makefile
@missknissmisskniss added this to theV2 Beta milestoneMay 15, 2022
kylecarbs pushed a commit that referenced this pull requestJun 10, 2022
…1308)* feat: Implement pagination for template versions* feat: Use unified pagination between users and template versions* Sync codepaths between users and template versions* Create requestOption type in codersdk and add test* Fix created_at edge case for pagination cursor in queries* feat: Add support for json omitempty and embedded structs in apitypings (#1318)* Add scripts/apitypings/main.go to Makefile
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@coadlercoadlercoadler approved these changes

@presleyppresleyppresleyp approved these changes

@deansheatherdeansheatherdeansheather approved these changes

@BrunoQuaresmaBrunoQuaresmaAwaiting requested review from BrunoQuaresma

Assignees

@mafredrimafredri

Labels
None yet
Projects
None yet
Milestone
V2 Beta
Development

Successfully merging this pull request may close these issues.

5 participants
@mafredri@presleyp@coadler@deansheather@misskniss

[8]ページ先頭

©2009-2025 Movatter.jp