Giter Site home page Giter Site logo

knit-ts's People

Contributors

chrispine avatar dependabot[bot] avatar paul-sachs avatar srikrsna-buf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

knit-ts's Issues

Relation must have intermediate Value message

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?

Support default results for missing fields

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.

Context

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.