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

Allow header OR body overwrite in response md #272

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/prmd/templates/schemata/link.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#### Response Example

```
<%- if response_example %>
<%- if response_example.has_key?('head') %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we might need to check if it is nil first, then do has_key? Otherwise it will blow up on has_key? undefined for nil I think.

<%= response_example['head'] %>
<%- else %>
HTTP/1.1 <%=
Expand All @@ -62,9 +62,9 @@ HTTP/1.1 <%=
<%- end %>
```

<%- if response_example || link['rel'] != 'empty' %>
<%- if response_example.has_key?('body') || link['rel'] != 'empty' %>
```json
<%- if response_example %>
<%- if response_example.has_key?('body') %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we should probably change this to just have the whole thing if it doesn't have body maybe? I would hate to break backwards compatibility anyway if it can be avoided.

<%= response_example['body'] %>
<%- else %>
<%- if link['rel'] == 'empty' %>
Expand Down