Skip to content
Discussion options

You must be logged in to vote

Replying to myself...


This validate an OpenAPI spec with ruleset oas from @stoplight/spectral-rulesets.

NOTE: I tried using ruleset from @stoplight/spectral-documentation but my bundler (vite) cannot import it.

# install deps
pnpm add @stoplight/spectral-core @stoplight/spectral-rulesets

# this combo worked
@stoplight/spectral-core 1.20.0
@stoplight/spectral-rulesets 1.22.0
import Spectral from "@stoplight/spectral-core";
import { oas } from "@stoplight/spectral-rulesets";

type SpecJson = Record<string, any>;
type ValidateSpecOptions = {
  specJson: SpecJson,
};

export async function validateWithSpectral(options: ValidateSpecOptions) {
  try {
    const spectral = new Spectral.Spectral()

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by tresorama
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant