Code Monkey home page Code Monkey logo

Comments (5)

chrusty avatar chrusty commented on August 29, 2024

Hi @k-jay-c, yeah OK I see what you're saying here. Let me take a look and figure out how easy this would be to implement.

from protoc-gen-jsonschema.

chrusty avatar chrusty commented on August 29, 2024

Alright, one thing to mention is that this would only ever apply to Proto2 (as with Proto3 we have to assume the defaults, being every field is optional).

from protoc-gen-jsonschema.

k-jay-c avatar k-jay-c commented on August 29, 2024

Hi @chrusty,

I believe this logic can apply to Proto3 as well. By applying the flag "all_fields_required", we're overwriting the default proto3 behaviour. This enhancement allows for more fine grained control to define which fields to treat as required. Alternative could be a new flag - all_non_optional_fields_required?

Thanks,
Jay.

from protoc-gen-jsonschema.

ZeeD avatar ZeeD commented on August 29, 2024

FWIW I would find very useful to be able to mark as required only the "non-optional" fields. On proto3 they have re-added optional too, and the rationale is a bit complex to follow, but it's available here.
In our project we are basically following what they call Explicit presence discipline but at the end we try to use the .proto files also to build our datamodel schema, and we assume that if a field does not have the "optional" keyword should be treated as required.

from protoc-gen-jsonschema.

ZeeD avatar ZeeD commented on August 29, 2024

@chrusty sorry to bother, but are there any news about this issue?

from protoc-gen-jsonschema.

Related Issues (20)

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.