Skip to content

Allow markdown docs to be inserted in the generated blueprint #8

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

Open
petrbela opened this issue Oct 1, 2013 · 4 comments
Open

Allow markdown docs to be inserted in the generated blueprint #8

petrbela opened this issue Oct 1, 2013 · 4 comments

Comments

@petrbela
Copy link

petrbela commented Oct 1, 2013

So, we have this idea for the ideal workflow:

  1. Write your request specs
  2. Run your request specs and the whole apib file will be generated for you

There are two things missing to get to this state:

  • copy markdown docs to the generated txt (or better .md)
  • concat generated files to one apib file (will open another issue)

I can imagine the docs would either be in the source file (controller) or spec file. I'd probably go with the spec file as it will keep the information in one place, and also implementation will be easier.

The gem should copy the markdown docs from comments and place them in the generated file.

# Arena represents a combat room.
#
# Attributes:
#
# - `name` - arena name
# - `owner` - user who created the arena
describe 'Arenas Requests' do

  # Fetch information about an arena.
  describe 'GET /v1/arenas/{id}' do
    it 'responds with the requested arena' do
      arena = create :arena, foursquare_id: '5104'
      get v1_arena_path(arena)

      response.status.should eq(200)
    end
  end

end

Would generate

# Group Arenas
Arena represents a combat room.

Attributes:

- `name` - arena name
- `owner` - user who created the arena

## GET /v1/arenas/{id}
Fetch information about an arena.

+ Response 200 (application/json)

    {
      "arena": {
        "id": "4e9dbbc2-830b-41a9-b7db-9987735a0b2a",
        "name": "Clinton St. Baking Co. & Restaurant",
        "latitude": 40.721294,
        "longitude": -73.983994,
        "foursquare_id": "5104"
      }
    }
@matteodepalo
Copy link

Sorry for responding late. This seems like a great idea, however I don't have time currently to develop it. If you want to take a stab at it I would gladly merge it.

@petrbela
Copy link
Author

I've actually already started, will send a pull request when it gets usable by public.

Petr Bela

On Saturday, October 12, 2013 at 8:50 PM, Matteo Depalo wrote:

Sorry for responding late. This seems like a great idea, however I don't have time currently to develop it. If you want to take a stab at it I would gladly merge it.


Reply to this email directly or view it on GitHub (#8 (comment)).

@kpgdev
Copy link

kpgdev commented Nov 27, 2013

this is exactly what i need too..... anything i can do to help, code, test?

@petrbela
Copy link
Author

Sorry this took a bit longer than expected. I decided to put the docs in the source files (as opposed to specs) as that's where docs usually go. I just pushed a branch to petrbela/rspec_api_blueprint#feat/markdown-docs -- @kpgdev can you take a look if it solves your problem, and post feedback on #9?

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

3 participants