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.

Identify subpar error messages

See original GitHub issue

Chore summary

Although the overall usefulness of errors reported by Spectral has increased over the course of last months, there is still plenty of room for improvement.

Certain errors are still inconsistent, some of them are not particularly human-friendly, to say at least. Error messages that are not constant are primarily prone to be troublesome since there is a variety of cases to cover, therefore let’s focus on them - looking at you, schema function.

To help us identify flaws, we can leverage some existing repositories containing plenty of public APIs, such as APIs guru, and similar.

Then, ideally, in the context of Studio, let’s play around with specs using form or code view and watch errors produced in the diagnostics panel - see whether they make sense, they are easy to locate, and ideally, easy to resolve by a potentially non-technical person.

While testing the openapi documents and playing around making edits in studio forms/code view, document each subpar spectral error that you come across, along with as basic a spec document example as possible to reproduce the bad error.

Chore Scope

Let’s accumulate these bad error messages and an example reproduction spec for each one in this issue (we’ll use these example specs as test cases when we improve the errors). Fixing the issues is out of scope, we’ll create a separate issue once this is done. I suggest time boxing this exercise to a couple of hours.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
philsturgeoncommented, Apr 29, 2020

Here’s a not entirely helpful issue:

image

We need to override this to try and talk about the specific extra item that should not be there.

openapi: 3.0.0
info:
  title: Should Not Have What API
  version: '1.0'
  contact:
    email: phil@stoplight.io
  description: >
    We get a "should NOT have addition properties" which points to `paths`, with no further information about the actual problem.

servers:
  - url: 'http://localhost/api/v1'

paths:
  regions/{id}':
    get:
      summary: Get region
      responses:
        '200':
          description: OK

Back in the day we used to have message and details, one of which was a short one-liner and the other was “more information”. We were inconsistent with which one was going to be the useful “show this in the listing” and which was going to contain specific information about the problem so we threw it away, but I would love to see a “More Information” come back.

It would be pretty useful to explain background information for rules, like we do in the ruleset docs over here https://stoplight.io/p/docs/gh/stoplightio/spectral/docs/reference/openapi-rules.md

But it would also be good to see the full error if people wanted to try and figure out what was going on. I’d rather see JSON-blobs of raw AJV output than be given nothing to work with (in Studio or anywhere else).

0reactions
jonsgoldcommented, May 31, 2020

I don’t know if this has been identified yet. Using "required": true gives error oas3-schema 'requestBody' property should have required property '$ref':

{
  "components": {
    "schemas": {
      "association_by_id": {
        "oneOf": [{ "type": "string" }, { "type": "integer" }]
      },
      "association_by_name": {
        "type": "object",
        "oneOf": [{
          "type": "object",
          "required": ["name"],
          "properties": {
            "name": { "type": "string", "required": true }
          }
        },
        { "enum": ["nil", "", null] }]
      }
    }
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error Messages: Examples, Best Practices & Common Mistakes
4 common mistakes with error messages · 1. Ambiguity · 2. Condescending language/blaming the user · 3. Poor placement of error messages ·...
Read more >
Understanding Success Criterion 3.3.1: Error Identification | WAI
The intent of this Success Criterion is to ensure that users are aware that an error has occurred and can determine what is...
Read more >
Troubleshooting Supernova -Software -De Novo Assembly -Official ...
By far the most common cause of subpar assembly results is poor input DNA ... find output_dir -name _stderr and may contain elucidating...
Read more >
How to stop Check Disk on external drive on Windows 10? – Pink ...
Please enter the error message or code that you are seeing. How to Identify Laptop Drive Information. We can safely abort the operation...
Read more >
Auditing Beau's new website - Koalati
Find out what our QA of Beau's new website has revealed! ... This, my friends, is an error message written by a developer....
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