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: Switch packages for typescript generation code#1196

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

Merged
Emyrk merged 18 commits intomainfromstevenmasley/redo_typescript_gen
Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
18 commits
Select commitHold shift + click to select a range
ee71acd
feat: Switch packages for typescript generation code
EmyrkApr 27, 2022
b0b17d0
Add enum functionality
EmyrkApr 28, 2022
28c2811
Handle reused types
EmyrkApr 28, 2022
710b427
Add comment
EmyrkApr 28, 2022
071026d
Allow ignoring types for autogen
EmyrkApr 28, 2022
2741efa
Fix ignore, add optional fields
EmyrkApr 28, 2022
c62feeb
Add map support
EmyrkApr 28, 2022
462ebeb
Handle unknown types better
EmyrkApr 28, 2022
21d1687
Add comments, run gen
EmyrkApr 28, 2022
9a3d7e3
Add basic readme
EmyrkApr 28, 2022
1afaa5d
Merge remote-tracking branch 'origin/main' into stevenmasley/redo_typ…
EmyrkApr 28, 2022
7cfba41
Reorder imports
EmyrkApr 28, 2022
0127e6d
Sort all output
EmyrkApr 28, 2022
0d943f1
Add 'DO NOT EDIT' to the top
EmyrkApr 28, 2022
2379c21
Go linting
EmyrkApr 28, 2022
3865f36
Fix typescript linter
EmyrkApr 28, 2022
176b481
Use correct array size for allocation
EmyrkApr 28, 2022
0d37eeb
Update readme
EmyrkApr 28, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletionscodersdk/client.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,6 +26,7 @@ func New(serverURL *url.URL) *Client {
}

// Client is an HTTP caller for methods to the Coder API.
// @typescript-ignore Client
typeClientstruct {
HTTPClient*http.Client
SessionTokenstring
Expand DownExpand Up@@ -113,6 +114,7 @@ func readBodyAsError(res *http.Response) error {
}

// Error represents an unaccepted or invalid request to the API.
// @typescript-ignore Error
typeErrorstruct {
httpapi.Response

Expand Down
1 change: 1 addition & 0 deletionsgo.mod
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -109,6 +109,7 @@ require (
golang.org/x/sysv0.0.0-20220412211240-33da011f77ad
golang.org/x/termv0.0.0-20210927222741-03fcf44c2211
golang.org/x/textv0.3.7
golang.org/x/toolsv0.1.10
golang.org/x/xerrorsv0.0.0-20220411194840-2f41105eb62f
google.golang.org/apiv0.75.0
google.golang.org/protobufv1.28.0
Expand Down
1 change: 1 addition & 0 deletionsgo.sum
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2287,6 +2287,7 @@ golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/toolsv0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/toolsv0.1.6-0.20210726203631-07bc1bf47fb2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/toolsv0.1.10 h1:QjFRCZxdOhBJ/UNgnBZLbNV13DlbnK0quyivTnXJM20=
golang.org/x/toolsv0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
golang.org/x/xerrorsv0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrorsv0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrorsv0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
40 changes: 40 additions & 0 deletionsscripts/apitypings/README.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
#APITypings
Copy link
Contributor

Choose a reason for hiding this comment

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

praise: Wonderful documentation!


This main.go generates typescript types from the codersdk types in Go.

#Features

- Supports Go types
-[x] Basics (string/int/etc)
-[x] Maps
-[x] Slices
-[x] Enums
-[x] Pointers
-[ ] External Types (uses`any` atm)
- Some custom external types are hardcoded in (eg: time.Time)


##Type overrides

```golang
typeFoostruct {
// Force the typescript type to be a number
CreatedAt time.Duration`json:"created_at" typescript:"number"`
}
```

##Ignore Types

Do not generate ignored types.

```golang
// @typescript-ignore InternalType
typeInternalTypestruct {
// ...
}
```

#Future Ideas

- Should`omitempty` in the`json` tag indicate optional?
- Use a yaml config for overriding certain types
Loading

[8]ページ先頭

©2009-2025 Movatter.jp