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

Display documentation similar to operations? #4894

Closed
fewcifur opened this issue Sep 24, 2018 · 2 comments
Closed

Display documentation similar to operations? #4894

fewcifur opened this issue Sep 24, 2018 · 2 comments

Comments

@fewcifur
Copy link

fewcifur commented Sep 24, 2018

(I am new to this so please bear with me)

I have an API spec with extensive documentation in the "description" section. As a result, it takes an age to scroll down to the actual operations. Unfortunately, external documentation isn't an option right now.

I would like to have the documentation sections displayed in a group, similar to the way operations are displayed via tags. Unfortunately, I can't figure out how to do this without specifying it as GET etc.

Is there any way to display a "Documentation" tags group without specifying the method? Or is there a way to hide this method for one operation?

I'm using Swagger 2.0

@shockey
Copy link
Contributor

shockey commented Sep 25, 2018

Hmmmm, good question.

Here's a plugin that makes your API Info block (which includes the description) collapsible:

const CollapsibleDescriptionPlugin = (system) => {
  const React = system.React
  
  return {
    wrapComponents: {
      info: (OriginalComponent) => system.React.createClass({
        getInitialState() {
          return {
            isOpened: true
          }
        },
        onClick() {
          this.setState({ isOpened: !this.state.isOpened })
        },
        render() {
          const Collapse = system.getComponent("Collapse")
          return <div>
            <h2 onClick={this.onClick}>Description 
              <small>{this.state.isOpened ? "▼" : "▶"}</small>
            </h2>
            <Collapse isOpened={this.state.isOpened}>
              <OriginalComponent {...this.props} />
            </Collapse>
          </div>
        }
      })
    }
  }
}

@shockey
Copy link
Contributor

shockey commented Oct 11, 2018

Closing due to inactivity.

This is simply to keep our issue tracker clean - feel free to comment if there are any further thoughts or concerns, and we'll be happy to reopen this issue.

@shockey shockey closed this as completed Oct 11, 2018
@lock lock bot locked and limited conversation to collaborators Oct 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants