@hyperjump/json-schema 0.21.0 → 0.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -101,18 +101,23 @@ MediaTypePlugin to support that.
101
101
  way JSON is supported.
102
102
  * **MediaTypePlugin**: object
103
103
 
104
- * parse: (response: Response) => string -- Given a fetch Response object,
105
- parse the body of the request
106
- * matcher: (path) => boolean -- Given a filesystem path, return whether or
107
- not the file should be considered a member of this media type
104
+ * parse: (response: Response, mediaTypeParameters: object) => [SchemaObject, string]
105
+
106
+ Given a fetch Response object, parse the body of the request. Return the
107
+ parsed schema and an optional default dialectId.
108
+ * matcher: (path) => boolean
109
+
110
+ Given a filesystem path, return whether or not the file should be
111
+ considered a member of this media type.
108
112
 
109
113
  ```javascript
110
114
  const JsonSchema = require("@hyperjump/json-schema");
115
+ const YAML = require("yaml");
111
116
 
112
117
 
113
118
  // Add support for JSON Schemas written in YAML
114
119
  JsonSchema.addMediaTypePlugin("application/schema+yaml", {
115
- parse: async (response) => YAML.parse(await response.text()),
120
+ parse: async (response) => [YAML.parse(await response.text()), undefined],
116
121
  matcher: (path) => path.endsWith(".schema.yaml")
117
122
  });
118
123