The schema server is an HTTP server that provides a convenient way to browse and use the OASF schema.
This section describes how to build and run the OASF Schema server.
The Schema server is written in Elixir using the Phoenix Web framework.
The Elixir site maintains a great installation page, see this for help.
Elixir uses the mix build tool, which is
included in the Elixir installation package.
mix local.hex --force && mix local.rebar --forceChange to the server directory, fetch, and compile the dependencies:
cd server
mix do deps.get, deps.compilemix compileYou can use mix test command to test the changes made to the schema.
For example, to ensure the JSON files are correct or the attributes are defined,
with this command:
SCHEMA_DIR=../schema SCHEMA_EXTENSION=extensions mix testIf everything is correct, then you should not see any errors or warnings.
You can use the Elixir's interactive shell, IEx, to start the schema server use:
SCHEMA_DIR=../schema SCHEMA_EXTENSION=extensions iex -S mix phx.serverNow you can access the Schema server at
localhost:8080.
You can use the following command in the iex shell to force reloading the
schema with extensions:
Schema.reload(["<extension folder>", "<extension folder>", ...])Reload the core schema without extensions:
Schema.reload()Reload the schema only with the example extension (note that the folder is relative
to the SCHEMA_DIR folder):
Schema.reload(["extensions/example"])Reload the schema with all extensions defined in the extensions folder (note that
the folder is relative to the SCHEMA_DIR folder):
Schema.reload(["extensions"])Reload the schema with extensions defined outside the SCHEMA_DIR folder (use
an absolute or relative path):
Schema.reload(["/home/schema/cloud", "../dev-ext"])The schema server uses a number of environment variables.
| Variable Name | Description |
|---|---|
| HTTP_PORT | The server HTTP port number, default: 8080 |
| SCHEMA_DIR | The directory containing the schema, default: ../schema |
| SCHEMA_EXTENSION | The directory containing the schema extensions, relative to SCHEMA_DIR or absolute path |
| RELEASE_NODE | The Erlang node name. Set it if you want to run more than one server on the same computer |
SCHEMA_DIR=../schema SCHEMA_EXTENSION=extensions iex -S mix phx.server