-
Notifications
You must be signed in to change notification settings - Fork 309
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
web: add generators for typescript defs #2422
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,28 @@ | ||
FROM golang:1.12-alpine | ||
RUN apk update | ||
RUN apk add protobuf protobuf-dev git wget make | ||
RUN go get -u github.com/golang/protobuf/protoc-gen-go github.com/golang/protobuf/jsonpb github.com/golang/protobuf/proto github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway google.golang.org/grpc | ||
|
||
RUN apk add \ | ||
protobuf \ | ||
protobuf-dev \ | ||
git \ | ||
wget \ | ||
make \ | ||
nodejs \ | ||
yarn | ||
|
||
RUN go get -u \ | ||
github.com/golang/protobuf/protoc-gen-go \ | ||
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway \ | ||
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger \ | ||
google.golang.org/grpc \ | ||
github.com/google/wire/cmd/wire | ||
|
||
RUN go get golang.org/x/tools/cmd/goimports | ||
RUN cd /tmp && wget https://github.com/grpc/grpc-web/releases/download/1.0.6/protoc-gen-grpc-web-1.0.6-linux-x86_64 && mv protoc-gen-grpc-web-1.0.6-linux-x86_64 /usr/local/bin/protoc-gen-grpc-web && chmod +x /usr/local/bin/protoc-gen-grpc-web | ||
RUN go get -u github.com/google/wire/cmd/wire | ||
|
||
RUN cd /tmp && \ | ||
wget https://github.com/grpc/grpc-web/releases/download/1.0.6/protoc-gen-grpc-web-1.0.6-linux-x86_64 && \ | ||
mv protoc-gen-grpc-web-1.0.6-linux-x86_64 /usr/local/bin/protoc-gen-grpc-web && \ | ||
chmod +x /usr/local/bin/protoc-gen-grpc-web | ||
|
||
RUN yarn global add \ | ||
@manifoldco/swagger-to-ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
{ | ||
"swagger": "2.0", | ||
"info": { | ||
"title": "pkg/webview/view.proto", | ||
"version": "version not set" | ||
}, | ||
"schemes": [ | ||
"http", | ||
"https" | ||
], | ||
"consumes": [ | ||
"application/json" | ||
], | ||
"produces": [ | ||
"application/json" | ||
], | ||
"paths": { | ||
"/api/proto/view": { | ||
"get": { | ||
"operationId": "GetView", | ||
"responses": { | ||
"200": { | ||
"description": "A successful response.", | ||
"schema": { | ||
"$ref": "#/definitions/webviewView" | ||
} | ||
} | ||
}, | ||
"tags": [ | ||
"ViewService" | ||
] | ||
} | ||
} | ||
}, | ||
"definitions": { | ||
"webviewResource": { | ||
"type": "object", | ||
"title": "TODO(dmiller) fill this in" | ||
}, | ||
"webviewTiltBuild": { | ||
"type": "object", | ||
"properties": { | ||
"version": { | ||
"type": "string" | ||
}, | ||
"commitSHA": { | ||
"type": "string" | ||
}, | ||
"date": { | ||
"type": "string" | ||
}, | ||
"dev": { | ||
"type": "boolean", | ||
"format": "boolean" | ||
} | ||
} | ||
}, | ||
"webviewView": { | ||
"type": "object", | ||
"properties": { | ||
"log": { | ||
"type": "string" | ||
}, | ||
"resources": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/webviewResource" | ||
} | ||
}, | ||
"log_timestamps": { | ||
"type": "boolean", | ||
"format": "boolean" | ||
}, | ||
"feature_flags": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"type": "boolean", | ||
"format": "boolean" | ||
} | ||
}, | ||
"need_analytics_nudge": { | ||
"type": "boolean", | ||
"format": "boolean" | ||
}, | ||
"running_tilt_build": { | ||
"$ref": "#/definitions/webviewTiltBuild" | ||
}, | ||
"latest_tilt_build": { | ||
"$ref": "#/definitions/webviewTiltBuild" | ||
}, | ||
"tilt_cloud_username": { | ||
"type": "string" | ||
}, | ||
"tilt_cloud_schemeHost": { | ||
"type": "string" | ||
}, | ||
"tilt_cloud_teamID": { | ||
"type": "string" | ||
}, | ||
"fatal_error": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
**/__snapshots__/**/* | ||
src/view.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
declare namespace OpenAPI2 { | ||
export interface webviewView { | ||
log?: string; | ||
resources?: webviewResource[]; | ||
logTimestamps?: boolean; | ||
featureFlags?: object; | ||
needAnalyticsNudge?: boolean; | ||
runningTiltBuild?: webviewTiltBuild; | ||
latestTiltBuild?: webviewTiltBuild; | ||
tiltCloudUsername?: string; | ||
tiltCloudSchemeHost?: string; | ||
tiltCloudTeamID?: string; | ||
fatalError?: string; | ||
} | ||
export interface webviewTiltBuild { | ||
version?: string; | ||
commitSHA?: string; | ||
date?: string; | ||
dev?: boolean; | ||
} | ||
export interface webviewResource {} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the main thing to look at
separately, we should strategize on how to substitute these generated types for the handwritten types in types.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aww, it makes all of these optional fields? Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in proto3, fields can only be optional. there's some good discussion here:
protocolbuffers/protobuf#2497
https://capnproto.org/faq.html#how-do-i-make-a-field-required-like-in-protocol-buffers