question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Library does not support ! in GraphQL schema during the java classes generation

See original GitHub issue

Describe the bug During the java classes generation, all of the fields are nullable fields

To Reproduce Steps to reproduce the behavior: Run ./gradlew graphqlCodegen Check the generated classes. Fields have no difference between nullable and not nullable.

Expected behavior Nullable fields should be assigned null Not nullable fields should be the same as of now.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kobylynskyicommented, Sep 17, 2019

Done in 1.2.1

1reaction
PavelSusloparovcommented, Sep 17, 2019

Actually, I did it wrong. With validator here, I have the thing working.

fun testObject(): TestObject {
        val testObject = TestObject()
        val factory = Validation.buildDefaultValidatorFactory()
        val validator = factory.getValidator()
        val violations = validator.validate<TestObject>(testObject)
        val violationsString = violations.joinToString(", ")
        if (violationsString.isNotBlank()) {
            throw Exception(violationsString)
        }
        return testObject
    }

Thanks to https://www.baeldung.com/javax-validation

@kobylynskyi , yes I believe that is the good approach to go with.

Read more comments on GitHub >

github_iconTop Results From Across the Web

GraphQL Code Libraries, Tools and Services
A library of custom GraphQL scalar types for creating precise, type-safe GraphQL schemas. GraphQL-ESLint integrates GraphQL AST in the ESLint core (as a...
Read more >
GraphQL schema basics - Apollo GraphQL Docs
This schema defines a hierarchy of types with fields that are populated from your back-end data stores.
Read more >
facebook graph api - GraphQL schema generation
I know that the GraphQL Java library has the below line documented. /** Building this object is very cheap and can be done...
Read more >
Spring for GraphQL Documentation
Spring for GraphQL provides support for Spring applications built on GraphQL Java. It is a joint collaboration between the GraphQL Java team ...
Read more >
Approaches to Schema Development with GraphQL & Java
The downside of this approach is that the schema doesn't exist until some server code is written, introducing a dependency between the client-side...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found