Skip to main content
3 votes

What is the purpose of adding a schema validation in responses?

I used to do this with XML back in the day. The idea is that you give your clients a schema and you should guarantee that you follow it, otherwise you might cause an error. I agree with you though, ...
Ewan's user avatar
  • 84.6k
2 votes

Content Types of JSON in particular schema

You might be able to use content-type parameters as in application/json; schema=foo application/json; schema=bar I don't know whether adding user-defined parameters is officially blessed, but as long ...
Hans-Martin Mosner's user avatar
2 votes

Is JSON Schema-based runtime validation more practical than static type hints in real-world Python applications?

From the comments on the question: [amon] Use Pydantic. Get static typing and JSON Schema validation. [agolta] Given that both serve the same purpose, using JSON Schema appears to be the more ...
JimmyJames's user avatar
  • 31.1k
2 votes
Accepted

Where should schemas be maintained?

This looks like something a good old version control system such as git could handle well. The stuff that you're versioning is basically textual in nature, and git etc. handle evolving texts pretty ...
Hans-Martin Mosner's user avatar
2 votes

Correct way to return JSON schemas in a REST API

It is not clear for me if you are at the client side or backend side, but what you have mentioned so far is that you are moving to more Contract-First approach, which is common in SOAP, but what you ...
Reema's user avatar
  • 46
1 vote

Content Negotiation: Is a meta representation of a resource, like a JSON Schema, an appropriate REST representation?

I think that this is a cool idea to the extent of it's intended purpose. That being said, I DO NOT think that it would be appropriate by any means to attach it to the GET /student/{id} endpoint. The ...
Chaplin Marchais's user avatar
1 vote

Is JSON Schema-based runtime validation more practical than static type hints in real-world Python applications?

Let's start with the most important observation: static analysis is almost always superior to runtime checks. Because it allows you to catch errors before the actual code runs, before it is deployed. ...
freakish's user avatar
  • 3,085
1 vote

Is JSON Schema-based runtime validation more practical than static type hints in real-world Python applications?

deeply nested dict/JSON structures This is your problem, or at least why type hints aren't working for you. If you want Python's type hinting to work for you, don't have deeply nested dict-equivalent ...
Philip Kendall's user avatar
1 vote
Accepted

Correct way to return JSON schemas in a REST API

I have seen some people suggesting creating an endpoint called /schemas/ Most of the validation schemes out there are public, hence, have a route. So yes, you need to make it public. It doesn't mean ...
Laiv's user avatar
  • 15k
1 vote

How to model JSON data so it can be easily de-serialized in to simple Java classes?

I think your question may have been answered over at Stack Overflow. It involves using the http://json-schema.org/ spec for designing your JSON and converting it with https://github.com/joelittlejohn/...
Adrian J. Moreno's user avatar
1 vote
Accepted

How to model JSON data so it can be easily de-serialized in to simple Java classes?

When object serialization is involved a Data Transfer Object (as you mentioned) gives you the flexibility you need to mirror the JSON structure in an object oriented language. Each tech stack has a ...
Greg Burghardt's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible