bufbuild / knit-ts Goto Github PK
View Code? Open in Web Editor NEWTypeScript client for Knit
License: Apache License 2.0
TypeScript client for Knit
License: Apache License 2.0
When defining a relation and using the protoc-gen-knit-ts
plugin to process it, the following relation fails:
message GetQuoteFilmRequest {
repeated buf.starwars.quote.v1.Quote bases = 1;
}
message GetQuoteFilmResponse {
repeated buf.starwars.film.v1.Film values = 1;
}
service RelationService {
rpc GetQuoteFilm(GetQuoteFilmRequest) returns (GetQuoteFilmResponse) {
option (buf.knit.v1alpha1.relation).name = "film";
option idempotency_level = NO_SIDE_EFFECTS;
}
}
The plugin returns the error, where 11 is the number of fields in Film
:
protoc-gen-knit-ts: GetQuoteFilm: relation must have exactly one field, found 11
However, this alternate longer definition works because it wraps the Film
in an intermediate message.
message GetQuoteFilmRequest {
repeated buf.starwars.quote.v1.Quote bases = 1;
}
message GetQuoteFilmResponse {
repeated Value values = 1;
message Value {
buf.starwars.film.v1.Film film = 1;
}
}
service RelationService {
rpc GetQuoteFilm(GetQuoteFilmRequest) returns (GetQuoteFilmResponse) {
option (buf.knit.v1alpha1.relation).name = "film";
option idempotency_level = NO_SIDE_EFFECTS;
}
}
When the relation is one-to-one like between Quote
and Film
, the intermediate Value
message should not be needed?
When explicitly querying for non-optional fields in a knit request, the resulting Typescript response type has those fields marked as optional. This only seems to apply to fields that are a message type, scalar fields seem to work as expected in this case.
There doesn't seem to be any way to specify headers on a request, for example, to provide authentication?
Does createClient function have a way to use client window.Fetch instead of internal fetch?
the createPromiseClient function does allow it as it's passed through the createConnectTransport
When a service doesn't respond with a requested field, we should be able to default the field to the defined default for each type.
While writing integration test mocks for knit endpoints, we often just want to mock sensible defaults without having to be explicit about the values and to just ensure type safety.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.