Coder Social home page Coder Social logo

dropwizard / dropwizard-protobuf Goto Github PK

View Code? Open in Web Editor NEW
51.0 51.0 21.0 2.22 MB

Support for reading and writing Google Protocol Buffer objects within Dropwizard

License: Apache License 2.0

Java 98.16% Shell 1.84%
dropwizard java protobuf protocol-buffers

dropwizard-protobuf's Introduction

Dropwizard

Build Quality Gate Status Maven Central Javadocs Documentation Status Maintainability Reproducible Builds Contribute with Gitpod

Dropwizard is a sneaky way of making fast Java web applications.

It's a little bit of opinionated glue code which bangs together a set of libraries which have historically not sucked:

Read more at dropwizard.io.

Want to contribute to Dropwizard?

Before working on the code, if you plan to contribute changes, please read the following CONTRIBUTING document.

Need help or found an issue?

When reporting an issue through the issue tracker on GitHub or sending an email to the Dropwizard User Google Group mailing list, please use the following guidelines:

  • Check existing issues to see if it has been addressed already
  • The version of Dropwizard you are using
  • A short description of the issue you are experiencing and the expected outcome
  • Description of how someone else can reproduce the problem
  • Paste error output or logs in your issue or in a Gist. If pasting them in the GitHub issue, wrap it in three backticks: ``` so that it renders nicely
  • Write a unit test to show the issue!

Sponsors

Dropwizard is generously supported by some companies with licenses and free accounts for their products.

JetBrains

JetBrains

JetBrains supports our open source project by sponsoring some All Products Packs within their Free Open Source License program.

dropwizard-protobuf's People

Contributors

camerondavison avatar carldea avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar dhatanian avatar joschi avatar jplock avatar nagibcs avatar renovate[bot] avatar usama-makhzoum 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  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  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dropwizard-protobuf's Issues

Give option to print default values in JSON bodies

In the current ProtocolBufferMessageBodyProvider implementation, default values in a Protobuf message are not printed in the JSON body. This is because JsonFormat.printer(), by default, does not print default values. So if you have a Protobuf message like:

message MyMessage {
    enum Outcome {
        DENY = 0;
        ALLOW = 1;
    }

    Outcome my_outcome = 0;

}

and your Protobuf message has the value my_outcome == Outcome.DENY, then my_outcome will not be included in the JSON body.

I've been able to change this by using the includingDefaultValueFields option to format the Protobuf messages in ProtocolBufferMessageBodyProvider:

final String formatted = JsonFormat.printer().omittingInsignificantWhitespace().includingDefaultValueFields().print(m);

Using this code, formatted would include my_outcome in the example above.

This is a nice feature, especially when the JSON is consumed by folks without knowledge of Protobuf or the models my service uses.

What do you think about making it an option for this library? If you agree it'd be useful, I'd be happy to contribute.

InvalidProtocolBufferExceptions thrown in ProtocolBufferMessageBodyProvider are not caught by InvalidProtocolBufferExceptionMapper

While ProtocolBufferMessageBodyProvider claims to throw IOExceptions - it actually catches any exception and unconditionally throws a WebApplicationException.

This means if an endpoint accepts a protobuf message, but is sent invalid data by a client, instead of returning a 400, as the InvalidProtocolBufferExceptionMapper would do if it caught an InvalidProtocolBufferException - a 500 error is returned.

It seems to me the the message body provider should catch and rethrow IOExceptions, or at least InvalidProtocolBufferExceptions.

If this is the intended behaviour, I can open a PR for it.

Support a debug format that will send the textformat-version instead?

Would you be supportive of using a querystring parameter or some other form of query that would allow developers to receive the response in text format instead of the message in binary? E.g.:

/someendpoint/?debug-prototextfmt=true

results in calling m.toString() instead of m.toByteArray()

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Base branch does not exist - skipping

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

Branch release/2.1.x
github-actions
.github/workflows/build.yml
  • dropwizard/workflows main
  • dropwizard/workflows main
.github/workflows/close_stale.yml
  • actions/stale v9@28ca1036281a5e5922ead5184a1bbf96e5fc984e
.github/workflows/codeql-analysis.yml
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • github/codeql-action v3@b611370bb5703a7efb587f9d136a52ea24c5c38c
  • github/codeql-action v3@b611370bb5703a7efb587f9d136a52ea24c5c38c
  • github/codeql-action v3@b611370bb5703a7efb587f9d136a52ea24c5c38c
.github/workflows/release.yml
  • dropwizard/workflows main
.github/workflows/trigger-release.yml
  • dropwizard/workflows main
maven
pom.xml
  • io.dropwizard.modules:module-parent 2.1.2
  • com.google.protobuf:protobuf-bom 4.27.2
  • kr.motd.maven:os-maven-plugin 1.7.1
  • org.xolstice.maven.plugins:protobuf-maven-plugin 0.6.1
  • com.spotify.fmt:fmt-maven-plugin 2.23
  • com.google.googlejavaformat:google-java-format 1.22.0
maven-wrapper
.mvn/wrapper/maven-wrapper.properties
  • maven 3.9.8
Branch release/3.0.x
github-actions
.github/workflows/build.yml
  • dropwizard/workflows main
  • dropwizard/workflows main
.github/workflows/close_stale.yml
  • actions/stale v9@28ca1036281a5e5922ead5184a1bbf96e5fc984e
.github/workflows/codeql-analysis.yml
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • github/codeql-action v3@b611370bb5703a7efb587f9d136a52ea24c5c38c
  • github/codeql-action v3@b611370bb5703a7efb587f9d136a52ea24c5c38c
  • github/codeql-action v3@b611370bb5703a7efb587f9d136a52ea24c5c38c
.github/workflows/release.yml
  • dropwizard/workflows main
.github/workflows/trigger-release.yml
  • dropwizard/workflows main
maven
pom.xml
  • io.dropwizard.modules:module-parent 3.0.2
  • com.google.protobuf:protobuf-bom 4.27.2
  • kr.motd.maven:os-maven-plugin 1.7.1
  • org.xolstice.maven.plugins:protobuf-maven-plugin 0.6.1
  • com.spotify.fmt:fmt-maven-plugin 2.23
  • com.google.googlejavaformat:google-java-format 1.22.0
maven-wrapper
.mvn/wrapper/maven-wrapper.properties
  • maven 3.9.8
Branch release/4.0.x
github-actions
.github/workflows/build.yml
  • dropwizard/workflows main
  • dropwizard/workflows main
.github/workflows/close_stale.yml
  • actions/stale v9@28ca1036281a5e5922ead5184a1bbf96e5fc984e
.github/workflows/codeql-analysis.yml
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • github/codeql-action v3@b611370bb5703a7efb587f9d136a52ea24c5c38c
  • github/codeql-action v3@b611370bb5703a7efb587f9d136a52ea24c5c38c
  • github/codeql-action v3@b611370bb5703a7efb587f9d136a52ea24c5c38c
.github/workflows/release.yml
  • dropwizard/workflows main
.github/workflows/trigger-release.yml
  • dropwizard/workflows main
maven
pom.xml
  • io.dropwizard.modules:module-parent 4.0.2
  • com.google.protobuf:protobuf-bom 4.27.2
  • kr.motd.maven:os-maven-plugin 1.7.1
  • org.xolstice.maven.plugins:protobuf-maven-plugin 0.6.1
  • com.spotify.fmt:fmt-maven-plugin 2.23
  • com.google.googlejavaformat:google-java-format 1.22.0
maven-wrapper
.mvn/wrapper/maven-wrapper.properties
  • maven 3.9.8

  • Check this box to trigger a request for Renovate to run again on this repository

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.