Incorrect 'Response As JSON Object:' violation
See original GitHub issueGiven the following swagger spec:
swagger: '2.0'
info:
version: "0.0.1"
title: API Example
schemes:
- "https"
basePath: /
produces:
- application/json
consumes:
- application/json
securityDefinitions:
oauth2:
type: oauth2
flow: password
tokenUrl: https://tokeninfo.example.com
scopes:
uid: Unique identifier of the user accessing the service.
security:
- oauth2: [uid]
paths:
'/resources':
get:
summary: List all resources
responses:
200:
description: List of all resources.
schema:
type: object
properties:
items:
type: array
items:
'$ref': '#/definitions/Resource'
500:
description: Unexpected error
definitions:
Resource:
type: object
properties:
name:
type: string
I get this violation when running the CLI:
$ cli/bin/zally swagger.yaml
Found the following MUST violations
===================================
Response As JSON Object:
Always Return JSON Objects As Top-Level Data Structures To Support Extensibility
/resources/GET/200
Summary:
=======
COULD violations: 0
SHOULD violations: 0
MUST violations: 1
Since the response type of /resources/GET/200
is:
{
"items": [Resource,]
}
I would not expect it to be a violation.
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
How to Fix “The Response Is Not a Valid JSON ... - iThemes
Top 5 Issues Behind “The response is not a valid JSON response” Error and How to Address Them · Incorrect WordPress Site Address...
Read more >java - JSON Object incorrect and causing HttpException
I updated the body to JSON which resulted in 2 validation errors. One was that service_id was missing and testkey was present so...
Read more >HTTP status and error codes for JSON | Cloud Storage
The following document provides reference information about the status codes and error messages that are used in the Cloud Storage JSON API.
Read more >Invalid JSON response — DataTables forums
The error message suggests that there is no columns information being sent to the server as part of the server-side processing request. I...
Read more >Schema - RapidJSON
The name of each member corresponds to the JSON Schema keyword that is violated. · The value is either an object describing a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I would like to pick that one. @fmueller are you in a process of fixing it or I can pick that?
Thank you for providing us with this detailed bug description. I could reproduce the issue with your swagger example. There is also a bigger issue with this rule implementation. Fixing it will take some time. But I’m on it.