generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow arbitrary types in requests/responses (#763)
This is a prerequisite for PubSub, but we've always wanted to loosen this restriction anyway. It was only in place temporarily until we get concurrent deployed versions working, but I think we can just guide people until that point. There are still restrictions for `@Ingress` verbs in that the request must still be a data structure, because the routing needs something to map the path parameters and query parameters onto.
- Loading branch information
1 parent
f9853f7
commit 1445b3b
Showing
67 changed files
with
1,429 additions
and
1,340 deletions.
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
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
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,33 @@ | ||
package schema | ||
|
||
// BuiltinsSource is the schema source code for built-in types. | ||
var BuiltinsSource = ` | ||
// Built-in types for FTL. | ||
builtin module builtin { | ||
// HTTP request structure used for HTTP ingress verbs. | ||
data HttpRequest { | ||
method String | ||
path String | ||
pathParameters {String: String} | ||
query {String: [String]} | ||
headers {String: [String]} | ||
body Bytes | ||
} | ||
// HTTP response structure used for HTTP ingress verbs. | ||
data HttpResponse { | ||
status Int | ||
headers {String: [String]} | ||
body Bytes | ||
} | ||
} | ||
` | ||
|
||
// Builtins returns a [Module] containing built-in types. | ||
func Builtins() *Module { | ||
module, err := ParseModuleString("builtins.ftl", BuiltinsSource) | ||
if err != nil { | ||
panic("failed to parse builtins: " + err.Error()) | ||
} | ||
return module | ||
} |
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
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
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,20 @@ | ||
package schema | ||
|
||
import ( | ||
"google.golang.org/protobuf/reflect/protoreflect" | ||
|
||
schemapb "github.com/TBD54566975/ftl/protos/xyz/block/ftl/v1/schema" | ||
) | ||
|
||
type Unit struct { | ||
Pos Position `parser:"" protobuf:"1,optional"` | ||
|
||
Unit bool `parser:"@'Unit'" protobuf:"-"` | ||
} | ||
|
||
var _ Type = (*Unit)(nil) | ||
|
||
func (u *Unit) schemaType() {} | ||
func (u *Unit) String() string { return "Unit" } | ||
func (u *Unit) ToProto() protoreflect.ProtoMessage { return &schemapb.Unit{Pos: posToProto(u.Pos)} } | ||
func (u *Unit) schemaChildren() []Node { return nil } |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.