Skip to content

nilshartmann/spring-graphql-optional

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring for GraphQL: Input-Types containing java.util.Optional with objects fail

Steps to reproduce

  • Start Server, open GraphiQL at http://localhost:31080
  • Run Query that works:
      mutation {
        createAccount(input:{
          id: "1",
          fullname: "Klaus"
        }
      )}
  • Note this query works, even fullname on the Java type AccountInput is a java.util.Optional
  • Try to add also a contact:
      mutation {
        createAccount(input:{
          id: "1",
          fullname: "Klaus",
    
          contact:{
            phone: "123"
          }
        })
      }
  • This mutation fails (Unable to make private java.util.Optional(java.lang.Object) accessible: module java.base does not "opens java.util" to unnamed module)
  • contact on the java record AccountInput is also a java.util.Optional (as fullname is), but contains another Record and not a Java primitive
  • Same problem occurs if instead of a Record a regular java class is used (see personalData)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages