@proto-nexus/proto-fields-plugin
@proto-nexus/proto-fields-plugin
npm i @proto-nexus/proto-fields-plugin
@proto-nexus/proto-fields-plugin

@proto-nexus/proto-fields-plugin

Protobuf-First GraphQL Schemas with GraphQL Nexus

by proto-graphql

0.5.1 (see all)License:MITTypeScript:Built-In
npm i @proto-nexus/proto-fields-plugin
Readme

@proto-nexus/proto-fields-plugin

npm version |

Nexus plugin for building subset types from proto-nexus's artifacts

// profile.proto

message Profile {
  // Required. User's first name.
  string first_name = 1;
  // Required. User's middle name.
  string middle_name = 2;
  // Required. User's last name.
  string last_name = 3;

  // Required.
  string introduction = 4;
}
import { makeSchema, inputObjectType } from "nexus";
import { protoFieldsPlugin } from "@proto-nexus/proto-fields-plugin";

import { ProfileInput } from "./path/to/protoc-gen-plugin-artifacts/profile_pb_nexus.ts";

const NameInput = inputObjectType({
  name: "NameInput",
  definition(t) {
    t.fromProto(ProfileInput, ["firstName", "middleName", "lastName"]);
  }
})

export schema = makeSchema({
  types: [ProfileInput, NameInput],
  plugins: [protoFieldsPlugin()],
})

// # Types will be generated:
//
// input NameInput {
//   """Required. User's first name."""
//   firstName: String!
//
//   """Required. User's middle name."""
//   middleName: String!
//
//   """Required. User's last name."""
//   lastName: String!
// }
//
// input ProfileInput {
//   """Required. User's first name."""
//   firstName: String!
//
//   """Required. User's middle name."""
//   middleName: String!
//
//   """Required. User's last name."""
//   lastName: String!
//
//   """Required."""
//   introduction: String!
// }

Downloads/wk

26

GitHub Stars

18

LAST COMMIT

1mo ago

MAINTAINERS

1

CONTRIBUTORS

3

OPEN ISSUES

7

OPEN PRs

9
VersionTagPublished
0.5.1
latest
1mo ago
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate