Skip to content

YAML schema support #470

Description

@akselerando

Love this plugin!

It would be nice to add YAML schema support

A quick and dirty solution could be to allow YAML data as input, but convert it to JSON behind the scenes.
A more proper solution would be even better ofc

Activity

  1. jy95 commented on Nov 6, 2024

    @jy95
    Owner

    Hello @akselerando ,

    I'm not against supporting it, just that a big part of this discussion is related to #258 (comment) : the parsing library, as you can also have YAML in $ref for instance. and must work transparently for end-users.

    Currently, it seems that @apidevtools/json-schema-ref-parser is the best candidate (in lack of better & maintained one) : would be interesting if someone give a try. In theory, most changes would be in the entrypoint file as typings are almost correct (just resolverOptions would need a change to be compliant to new parser options) :

    // What the user provides
    export type Props = {
      /**
       * The JSON schema to use
       */
      schema: unknown,
        /**
       * To customize the ref resolving
       * By default, only inline references will be dereferenced by @stoplight/json-ref-resolver
       */
      resolverOptions?: IResolveOpts
      }
      
     // What inner components use
    type InnerViewerProperties = {
         schema: JSONSchema
    }

    Would you or someone else like to give a hand ? Thx in advance

  2. Repository owner locked and limited conversation to collaborators on Nov 6, 2024
  3. converted this issue into a discussion #471 on Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions