Giter Club home page Giter Club logo

Comments (4)

kiiadi avatar kiiadi commented on July 18, 2024 1

The other complication for having Optional on our pojo's based on service models is that (currently) it's considered backwards compatible from a service API perspective to 'relax' the validation on a "required" field. This would result in compile-time backwards incompatibility. See lengthy discussion here aws/aws-sdk-java#965

One possibility is that for Pojo's we could annotate them with meta-data from the service model. This would be subject to change as the service model does but it might be a good indicator.

I agree for classes that we control returning Optional as opposed to null is desirable. I'd like to go further and annotate our methods with @Nonnull (or similar) when we know that we're not going to return null. This will aid interoperability with languages like Kotlin.

from aws-sdk-java-v2.

millems avatar millems commented on July 18, 2024

It might be tricky to standardize the throws-exception vs returns-null between services for existing APIs because we federate that out to the service owners, but returning Optional<Response> instead of null for services that do so for not-found results makes a lot of sense. Good catch.

from aws-sdk-java-v2.

dagnir avatar dagnir commented on July 18, 2024

Partly related is #529, so service responses will not return null Lists (and Maps in the future) unless customized to do so.

from aws-sdk-java-v2.

millems avatar millems commented on July 18, 2024

We're doing the best we can to fulfill this feature request as we build new features.

from aws-sdk-java-v2.

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.