ilib-loctool-openapi

A loctool plugin that knows how to localize openapi files

Usage no npm install needed!

<script type="module">
  import ilibLoctoolOpenapi from 'https://cdn.skypack.dev/ilib-loctool-openapi';
</script>

README

ilib-loctool-openapi

Ilib loctool plugin to parse and localize OpenAPI json files.

This plugin can parse and localize openapi.json files by using either default OpenAPI schema bundled with the plugin, or custom schema.

Configuration

Internally, this plugin uses two other loctool plugins: ilib-loctool-json and ilib-loctool-ghfm

OpenAPI plugin configuration is identical to JSON plugin's config. The only difference is openapi key used instead of json in settings section.

In order to use built-in OpenAPI schema use openapi-schema schema id in mappings section.

Example configuration:

{
    "settings": {
        "openapi": {
            "schemas": [
                "./schemas"
            ],
            "mappings": {
                "**/openapi.json": {
                    "schema": "openapi-schema",
                    "method": "copy",
                    "template": "resources/[localeDir]/appinfo.json"
                },
                "**/custom-openapi.json": {
                    "schema": "custom-schema",
                    "method": "copy",
                    "template": "[dir]/strings.[locale].json"
                }
            }
        }
    }
}

In the example above file openapi.json will be parsed using built-in schema and custom-openapi.json using custom schema from ./schemas folder.

License

This plugin is license under Apache2. See the LICENSE file for more details.

Release Notes

v1.0.3

  • Add missing tags section to the defaults schema

v1.0.2

  • Add schema.json to bundled files in order to be available at NPM

v1.0.1

  • Fix errors while loading default schema, relative path was replaced with an absolute.

v1.0.0

  • initial version
  • includes default schema for OpenAPI files parsing