jpadilla / django-rest-framework-yaml

YAML support for Django REST Framework
http://jpadilla.github.io/django-rest-framework-yaml
BSD 3-Clause "New" or "Revised" License
32 stars 18 forks source link

Document the output format #1

Closed tomchristie closed 9 years ago

tomchristie commented 9 years ago

Probably be worthwhile to include an example of the yaml output in the index.md and README.md

jpadilla commented 9 years ago

Does this output look alright?

- {email: jpadilla@example.com, is_staff: true, url: 'http://127.0.0.1:8000/users/1/.yaml',
  username: jpadilla}

Ran it through a linter and it looks like this.

--- 
- 
  email: jpadilla@example.com
  is_staff: true
  url: "http://127.0.0.1:8000/users/1/"
  username: jpadilla
tomchristie commented 9 years ago

Not sure. Not touched the yaml renderer since it went in.

tomchristie commented 9 years ago

Yes that format is correct... http://pyyaml.org/wiki/PyYAMLDocumentation#Dictionarieswithoutnestedcollectionsarenotdumpedcorrectly

Although it's likely that default_flow_style=False would be a nicer default. (Tho if that change does get made then let's make sure to highlight it as a difference when we release 3.1, and ensure it's easy enough to change by subclassing YAMLRenderer)

jpadilla commented 9 years ago

@tomchristie yeah I'm setting default_flow_style=False to be the default behavior for the renderer.

jpadilla commented 9 years ago

@tomchristie how about adding default_flow_style as a property on YAMLRenderer so if someone wanted the old behavior they'd just do:

class UglyYAMLRenderer(YAMLRenderer):
    default_flow_style = True
tomchristie commented 9 years ago

Yup that'd be fine. We can then document that in the "use django-rest-framework-yaml now" section of the 3.1 release notes.

tomchristie commented 9 years ago

Great! Although note the build failures due to the style change.

jpadilla commented 9 years ago

@tomchristie already took care of those, updated docs, and release v1.0.2

tomchristie commented 9 years ago

Rockin'