fern icon indicating copy to clipboard operation
fern copied to clipboard

[Bug] CLI fails to reload local dev env with no context when auth is set as Bearer in api.yml and no auth scheme is set

Open aidanhchau opened this issue 1 year ago • 2 comments

Describe the bug

Pretty much title. In the api.yml file, when setting the auth: parameter to something like Bearer, where the generator is expecting a subsequent

auth-schemes:
    Bearer: ...

but none is provided, the cli docs dev tool will print Failed to reload because of validation errors: and nothing else.

To reproduce

Steps to reproduce the behavior:

  1. Run the command fern docs dev to set up local dev environment with auto reload
  2. Write an api.yml file with an auth: set to a capitalized word (as opposed to a lowercase, i.e. Bearer vs bearer) with no auth-schemes: specified.
  3. CLI tool will reload and state Failed to reload because of validation errors: with no additional context, which makes this issue hard to debug.

Example api.yml:

name: api
auth: Bearer
error-discrimination:
  strategy: status-code
display-name: Example API
environments:
  Staging:
    docs: This is the staging environment for testing!
    url: http://api.exampleservice.com
default-environment: Staging

Expected behavior

I expect context in the error thrown by the cli pointing me to the api.yml file and telling me i have no auth-scheme specified.

Screenshots

image

CLI Version

0.30.0

aidanhchau avatar Jun 06 '24 16:06 aidanhchau

this seems to be an issue in many other cases of invalid fern definition.

for example, when an invalid type is supplied (int instead of the correct, integer) the cli will provide no context as to why and will show the same error: Failed to reload because of validation errors:

aidanhchau avatar Jun 06 '24 16:06 aidanhchau

Actually, issue can be easily resolved if the user just runs fern check --warnings. Was just expecting some context around the Failed to reload because of validation errors: due to the colon. Perhaps can change the error message to instruct the user to run fern check --warnings or provide some context after the colon? @dsinghvi feel free to close the issue though.

aidanhchau avatar Jun 09 '24 21:06 aidanhchau

We've since improved the error messaging here to be more specific: Screenshot 2024-12-14 at 14 35

this is on version 0.46.2. feel free to run fern upgrade to get the latest CLI version.

dannysheridan avatar Dec 14 '24 19:12 dannysheridan