Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline filter documentation #74

Open
datapimp opened this issue Aug 23, 2014 · 0 comments
Open

Inline filter documentation #74

datapimp opened this issue Aug 23, 2014 · 0 comments

Comments

@datapimp
Copy link

I'm working on my own library which subclasses mutations, and I am writing this to see if you would have any interest in merging this particular feature into the mutations gem itself. This will determine some aspects of my approach going forward

class UpdateBook < Mutations::Command
  required do
    desc "The title of the book"
    string :title

    optional do
       desc "Tags for the book"
       array :tags
    end
  end
end

This gives anyone the ability to generate documentation for the command's interface:

UpdateBook.interface_documentation

This produces (still a WIP)

{
  required_inputs: ["name"],
  optional_inputs: ["tags"],
  schema: {
    title: {
      type: "string",
      description: "The title of the book"
    },
    tags: {
      type: "array",
      description: "Tags for the book"
    }
  }
}

I have considered using just a description key in the options hash but think that this is not the optimal style of writing these kinds of things imo and it isn't inline with the rest of the conventions in my library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant