Skip to content
This repository has been archived by the owner on May 16, 2019. It is now read-only.

Should arg (.withArgs) handle description? #1

Closed
Paradoxia opened this issue Aug 5, 2017 · 8 comments
Closed

Should arg (.withArgs) handle description? #1

Paradoxia opened this issue Aug 5, 2017 · 8 comments

Comments

@Paradoxia
Copy link

Paradoxia commented Aug 5, 2017

I'm wondering if arg should also handle "description" when doing introspection. Currently i can only set/get "name" and "defaultValue".

Btw. After experimenting with multiple graphql frameworks (spent a week) i finally came to the conclusion that your library is the best one for Kotlin developers like me. I'm very grateful for your work.

@Paradoxia Paradoxia changed the title Should <arg> handle description? Should arg (.withArgs) handle description? Aug 5, 2017
@Paradoxia Paradoxia reopened this Aug 5, 2017
@pgutkowski
Copy link
Owner

arg definitely should handle description. I've done quick investigation and found cause of this bug, it will be fixed soon.

Thank you very much for your feedback and kind words! I'm really happy that you have found this library useful.

@Paradoxia
Copy link
Author

Paradoxia commented Aug 5, 2017

After some more debugging I noticed that "deprecate" becomes the description.

.withArgs { arg<Int> { name = "page" defaultValue = 0 deprecate("becomes description") } }

@pgutkowski
Copy link
Owner

That's true, I've messed up order of constructor arguments in DSL consumer, my bad, should have used explicit argument names.

@pgutkowski
Copy link
Owner

@Paradoxia issue has been fixed and merged to master. It will come out with next release in coming days. Thank you for your report!

@Paradoxia
Copy link
Author

@pgutkowski Awesome thank you. I found a similar problem on property

type<Production> {
    property<String?>("country") {
        description = "Country description"
        resolver { production -> production.country }
    }
}


{
  __type(name: "Production") {
    name
    description
    fields {
      name
      description
      type {
        name
        description
        kind
        ofType {
          name
          description
          kind
        }
      }
    }
  }
}


---> Slice from result -->

{
  "name": "country",
  "description": null, <---- MISSING
  "type": {
    "name": "String",
    "description": "The String scalar type represents textual data, represented as UTF‐8 character sequences",
    "kind": "SCALAR",
    "ofType": null
  }
}

The query doesn't output the description i created for property "country".

@pgutkowski
Copy link
Owner

pgutkowski commented Aug 5, 2017

It seems that you are doing the same thing as in #4, where property<> invocation ads new property which duplicates existing kotlin property.

Please try to add description with

type<Production> {
    property(Production::country) {
        description = "Country description"
    }
}

and see if description is missing.

In future there will be validation step added to ensure that extension properties do not shadow existing kotlin properties.

@Paradoxia
Copy link
Author

You are completely right. Code now works as expected. Handing out this 🥇 to you for your excellent library and support.

@pgutkowski
Copy link
Owner

Thanks! Always happy to help 😄

pgutkowski pushed a commit that referenced this issue Oct 20, 2018
Include Kotlin source files in source jar.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants