Specification of Protobuf-first GraphQL schemas.
- ๐ Type Mapping Rules
Protobuf-First GraphQL Schemas with JavaScript
License: MIT License
Specification of Protobuf-first GraphQL schemas.
input
message User {
// Required.
int64 id = 1 [graphql.field.name = "databaseId"];
}
output
export const User = objectType({
name: "User",
definition(t) {
t.field.("databaseId", {
type: nonNull("Int"),
resolve(root) { return root.getId() }
});
}
});
We got an error when we tried to generate the nexus
field for google.Type.Date
by using the proto-gen-nexus
(version: 0.6.2).
t.field("birthday", {
type: nullable("Date"),
resolve: (source) => {
const value = source.getBirthday();
if (value == null) {
return null;
}
// THE EXPECTED
return getTransformer("google.type.Date").protoToGql(value);
},
extensions: {
protobufField: { name: "birthday", typeFullName: "google.type.Date" },
},
t.field("birthday", {
type: nullable("Date"),
resolve: (source) => {
const value = source.getBirthday();
if (value == null) {
return null;
}
// ACTUALITY
return value;
},
extensions: {
protobufField: { name: "birthday", typeFullName: "google.type.Date" },
}
The error was found when handling WellKnownType. Currently, it only handles google.protobuf
type (by isProtobufWellKnownType), but does not handle google.Type
(google.Type.Date
)
As witnessed by the diff below, protoc-gen-nexus 0.6.4 is devoid of the whole ./lib
things. Probably the build step was missed out before publishing.
https://app.renovatebot.com/package-diff?name=protoc-gen-nexus&from=0.6.2&to=0.6.4
t.field("user", {
- type: nonNull("User"),
+ type: nonNull(User),
})
https://github.com/graphql-nexus/nexus/releases/tag/1.0.0
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates are currently rate-limited. Click on a checkbox below to force their creation now.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
.github/actions/setup-node/action.yml
.github/workflows/check-pr-labels.yml
.github/workflows/ci.yml
.github/workflows/release.yml
devPackages/testapis-proto/package.json
devPackages/tsconfig/package.json
e2e/helper/package.json
e2e/testapis/google-protobuf/package.json
e2e/testapis/protobufjs/package.json
e2e/testapis/ts-proto-with-forcelong-long/package.json
e2e/testapis/ts-proto-with-forcelong-number/package.json
e2e/testapis/ts-proto/package.json
package.json
@biomejs/biome 1.7.1
@bufbuild/buf 1.27.0
@bufbuild/protoc-gen-es 1.8.0
@changesets/changelog-github 0.5.0
@changesets/cli 2.27.1
@pothos/core 3.41.1
@swc/core 1.5.0
@types/google-protobuf 3.15.12
@types/minimatch 5.1.2
@types/node 20.12.7
google-protobuf 3.21.2
graphql 16.8.1
graphql-scalars 1.23.0
minimatch 5.1.2
nexus 1.3.0
protobufjs 7.2.5
protobufjs-cli 1.1.2
ts-proto 1.129.0
ts-protoc-gen 0.15.0
tsup 8.0.2
tsx 4.7.2
turbo 1.10.15
typescript 5.4.5
vitest 1.5.1
pnpm 9.0.5
packages/@proto-graphql/codegen-core/package.json
packages/@proto-graphql/proto-descriptors/package.json
packages/@proto-graphql/protoc-plugin-helpers/package.json
packages/@proto-nexus/google-protobuf/package.json
packages/@proto-nexus/proto-fields-plugin/package.json
packages/@proto-nexus/protobufjs/package.json
packages/proto-nexus/package.json
packages/protoc-gen-nexus/package.json
packages/protoc-gen-pothos/package.json
input
message User {
// Required.
int64 id = 1 [graphql.field.id = true];
}
output
export const User = objectType({
name: "User",
definition(t) {
t.field.("databaseId", {
type: nonNull("ID"),
resolve(root) { return root.getId() }
});
}
});
input:
message Entry {
// ...
oneof content {
Text text = 11;
Image image = 12;
Link link = 13;
}
}
message Text {
// ...
}
message Image {
// ...
}
message Link {
// ...
}
output:
const Entry = objectType({
// ...
})
const EntryContent = unionType({
name: 'EntryContent',
definition(t) {
t.members('Text', 'Image', 'Link')
},
resolveType: (item) => {
// ...
},
sourceType: {
// ...
}
})
const Text = objectType({
// ...
})
const Image = objectType({
// ...
})
const Link = objectType({
// ...
})
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.