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.

Interest in a JSON API-conformant example specification?

See original GitHub issue

Hi Swagger Team,

I’m working with an API that conforms to the JSON API spec, which has a JSON Schema definition that I have translated into Swagger YAML data type definitions (with a few bits like validations commented out that either the Swagger spec or some current tool implementations don’t support).

Working with this is exposing several issues for me in swagger-codegen, for example, that appear to be things the Swagger specification supports but the tools do not yet. additionalProperties: false is one example.

I’m also finding that code generated from swagger-codegen templates sometimes makes limited assumptions based on testing exclusively with Petstore, like model definitions only being objects and not arrays or primitives. The included construct in JSON API is an array, for instance, so a model of that causes issues right off the bat with generated ObjC code.

These are issues with swagger-codegen and I will and am reporting them there. But I’m wondering if a JSON API-based example might be welcomed in swagger-spec where it would be continuously validated and hopefully more likely to be adopted by the various tool projects for tests. If JSON API achieves popularity it might be a common use case, and an example spec will exercise some more advanced features that Swagger supports like polymorphic models.

If there’s interest in this I’ll prepare a PR for an example spec. If you think it’d be a better fit somewhere else (like just in swagger-codegen), I’m all ears, but I thought it might have worth as a more complex test case for several of the tool projects.

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:18 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
InteNscommented, Apr 18, 2018

in elixir/phoenix someone made a jsonapi module for swagger: https://github.com/xerions/phoenix_swagger

1reaction
MrTrickcommented, Mar 7, 2016

Hi @stevenxryan,
My apologies - since spending a heap more time with swagger I’ve discovered all sorts of horrible things… Like how the phrase “swagger uses an extended subset of json-schema” really means “swagger breaks a heap of json-schema things for no good reason”.

For example, external references? Swagger-editor and many other swagger parsers do not understand them. You’ll have to inline them.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSON:API — Latest Specification (v1.1)
JSON :API is a specification for how a client should request that resources be fetched or modified, and how a server should respond...
Read more >
A beginner's guide to JSON, the data format for the internet
JSON.parse(string) takes a string of valid JSON and returns a JavaScript object. For example, it can be called on the body of an...
Read more >
RFC 4627 on Json - IETF
A JSON text is a serialized object or array. Insignificant whitespace is allowed before or after any of the six structural characters.
Read more >
RFC 8259: The JavaScript Object Notation (JSON) Data ...
Internet Engineering Task Force (IETF) T. Bray, Ed. Request for Comments: 8259 ... This document removes inconsistencies with other specifications of JSON, ...
Read more >
JSON Schema Examples Tutorial - MongoDB
Let's look at an example of a JSON Schema for the above document type. ... If you are interested in knowing more about...
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