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.

Empty object as response

See original GitHub issue

I have a schema that is generating an empty object {} in the response, but it has a targetSchema defined. Here’s my schema:

	"$schema": "",
	"title": "API",
	"type": "object",
	"definitions": {
		"user": {
			"title": "User",
			"type": "object",
			"properties": {
				"id": {
					"title": "User ID",
					"type": "number"
				"firstName": {
					"title": "First Name",
					"type": "string"
				"lastName": {
					"title": "Last Name",
					"type": "string"
	"links": [
			"title": "Get User",
			"rel": "item",
			"type": "object",
			"description": "Retrieve a user by ID",
			"href": "/api/v1/users/{id}",
			"method": "GET",
			"targetSchema": {
				"$ref": "#/definitions/user"
screen shot 2017-06-13 at 12 38 48 pm

It seems it should be displaying a user object, or maybe I’m missing something.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:20 (10 by maintainers)

github_iconTop GitHub Comments

handrewscommented, Nov 8, 2017

@krystalmonolith I believe doca ignores anything without hyperschema links. It’s not intended as a data type documentation system, just an API documentation system. You could probably get it to work with non-API data types with a little tinkering, but it’s not in-scope for the project as it currently exists.

handrewscommented, May 1, 2018


This set of packages is being deprecated in favor of the JSON Schema Tools monorepo. Contributions are still welcome here but most work will be done on the new packages.

One of the big reasons for rewriting the Doca suite into a new set of packages was to adhere closely to the JSON Hyper-Schema specification, and make it easier to support newer drafts. This should eliminate unexpected schema behavior (except possibly when using Cloudflare-defined extensions, but hopefully we can be more clear about how those work alongside of standard schema constructs).

The new UI is still being designed, but hopefully this should be handled in it. Feel free to file at cloudflare/json-schema-tools if you want to track this specifically.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What does an empty object API response mean? #420 - GitHub
The empty object is needed because a valid JSON response is needed. It's not to prevent something breaking in backbone specifically.
Read more >
REST API Best practice ? return Empty object vs no object
The better practice is to send an empty array. The reason is when someone calls your API and expect expiring_credits ...
Read more >
Returning empty response object - ServiceNow Community
I am trying to generate response object from a different function and return it back but it does return only empty "".
Read more >
Handling JSON null and empty arrays and objects - IBM
Handling null and empty arrays and objects used in JSON data is described. JSON data has the concept of null and empty arrays...
Read more >
5 Ways to Check If an Object Is Empty in JavaScript | Built In
5 Ways to Check If an Object Is Empty in JavaScript · 1. Use Object.keys · 2. Loop Over Object Properties With for…in...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found