bufbuild/es: enable json_types=true in generated SDKs

Aberta
#2,890 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

  • #2891 de @saefty — fechado sem integrar

Avaliação

Dificuldade
1/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
25/100
Tipo de issue
Funcionalidade
Clareza
Claramente especificada
Status de atividade
Estagnada
Stack de tecnologia
typescript

Direção de pesquisa

Find the bufbuild/es plugin configuration that sets registry.opts for generated npm SDKs and read the surrounding versioning conventions. Add json_types=true as proposed, then verify the next generated SDK's .d.ts files include JSON message types while .js output stays unchanged. Pull request #2891 is already open for this issue.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

The generated npm SDKs of buf.build/bufbuild/es are built with registry.opts: [import_extension=js]. protoc-gen-es v2 also has the option json_types=true, which adds a type for the JSON form of every message. Users of the generated SDKs cannot set plugin options, so they never get these types.

Use case: HTTP APIs that use the protobuf JSON mapping instead of gRPC. A client that only needs types for the JSON it receives has to derive them itself or run buf generate.

Effect: The .js output does not change. The .d.ts files gain the JSON types. toJson() without options returns the message's JSON type instead of JsonValue, so code that annotates the result as JsonValue may no longer compile.

Proposed change: add json_types=true to registry.opts of the next bufbuild/es version.

Linguagem predominante
Dockerfile
Estrelas
75
Forks
27
Merge médio
5h 35min
PRs com merge (30d)
52

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de bufbuild/plugins

Todas as issues de bufbuild/plugins

Issues semelhantes

Mais issues de Backend & API Design

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.