@omnigraph/raml
Version:
This package generates `GraphQLSchema` instance from **RAML API Document** (`.raml`) file located at a URL or FileSystem by resolving the JSON Schema dependencies. It uses `@omnigraph/json-schema` by generating the necessary configuration.
24 lines (23 loc) • 1.18 kB
JavaScript
import { loadGraphQLSchemaFromJSONSchemas, loadNonExecutableGraphQLSchemaFromJSONSchemas, } from '@omnigraph/json-schema';
import { getJSONSchemaOptionsFromRAMLOptions } from './getJSONSchemaOptionsFromRAMLOptions.js';
/**
* Creates a local GraphQLSchema instance from a RAML API Document.
* Everytime this function is called, the RAML file and its dependencies will be resolved on runtime.
* If you want to avoid this, use `createBundle` function to create a bundle once and save it to a storage
* then load it with `loadGraphQLSchemaFromBundle`.
*/
export async function loadGraphQLSchemaFromRAML(name, options) {
const extraJSONSchemaOptions = await getJSONSchemaOptionsFromRAMLOptions(options);
return loadGraphQLSchemaFromJSONSchemas(name, {
...options,
...extraJSONSchemaOptions,
});
}
export async function loadNonExecutableGraphQLSchemaFromRAML(name, options) {
const extraJSONSchemaOptions = await getJSONSchemaOptionsFromRAMLOptions(options);
return loadNonExecutableGraphQLSchemaFromJSONSchemas(name, {
...options,
...extraJSONSchemaOptions,
});
}
export { processDirectives } from '@omnigraph/json-schema';