question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Zally reports violation of rule #110 for endpoints returning binary data

See original GitHub issue

I have endpoint which returns file content as binary

  "/reports/{report-id}":
    get:
      produces:
        - application/pdf
      responses:
        '200':
          description: Return report as a PDF file
          schema:
            type: file

Zally reports violation:

MUST – Response As JSON Object
Always Return JSON Objects As Top-Level Data Structures To Support Extensibility
Rule: https://zalando.github.io/restful-api-guidelines/#110

But in fact this is totally valid according to rule 168

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
tkropcommented, Feb 28, 2018

A media type is defined to have the following form:

top-level type name / subtype name [ ; parameters ]
top-level type name / [ tree. ] subtype name [ +suffix ] [ ; parameters ]

As a consequence the actual regex must look like:

^[^/]+/(json|[^+;]+\+json)(;.*)?$
1reaction
mkulakcommented, Feb 28, 2018

I propose to reverse this logic. Since we assume that JSON is default data type I think it makes sense to check for it by default. And skip this check only for those endpoints that both have content type specified and value of this content type doesn’t contain substring “json”. What do you think? @netme @tkrop @maxim-tschumak

Read more comments on GitHub >

github_iconTop Results From Across the Web

Zalando RESTful API and Event Guidelines
You may expose binary data. You must use a standard media type and data format, if applicable — see Rule 168. If no...
Read more >
RFC 4960: Stream Control Transmission Protocol
In SCTP, it is used by an endpoint to validate the State Cookie information that is returned from the peer in the COOKIE...
Read more >
Returning Individual Research Results to Participants
The return of aggregate research data or study-level results; ... Commonly reported concerns of participants include breaches of privacy and exposure to the ......
Read more >
3:20-cv-03671-MGL Date Filed 11/24/20 Entry Number 23 ...
law ” and that a violation of the rules may trigger “enforcement through disciplinary proceedings”). As the South Carolina Rules note, ...
Read more >
Stream Control Transmission Protocol RFC 4960
In SCTP, it is used by an endpoint to validate the State Cookie information that is returned from the peer in the COOKIE...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found