3.0.2 • Published 4 years ago

@commercetools-docs/gatsby-transformer-raml-legacy v3.0.2

Weekly downloads
129
License
MIT
Repository
-
Last release
4 years ago

GatsbyJS RAML API transformer (legacy parser based)

Notice

This plugin is based of the raml-1-parser which is deprecated. The plugin currently serves as a placeholder until it is replaced.

Overview

The Plugin exposes RAML APIs defined in .raml files on the GraphQL API as the canonical, effective API surface. It's internally using the raml-1-parser and raml2obj - currently in a fork with necessary extensions - to generate the representation and adds small structure changes to make the output GraphQL-compatible.

It is fully hot-reloading when editing the RAML specs, also when making changes on file inclusions inside the RAML format.

It provides

  • The API itself: ramlApi
  • The Types: ramlType

Usage

As a prerequisite configure one or many gatsby-source-filesystem plugins to for example point at src/api-specs and place your RAML files there. The APIs key on GraphQL is derived from the filename or, if the name is api.raml from the folder name.

Example gatsby-config.js content:

// In your gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `apis`,
        path: `${__dirname}/src/api-specs`,
      },
    },
    {
      resolve: `@commercetools-docs/gatsby-transformer-raml-legacy`,
      options: {
        validate: true,
      },
    },
  ],
};

Configuration Opions

The RAML transformer accepts the following configuration options:

  • validate (boolean): Passed through to the respective RAML parser option.
  • canonicalTypeImpl (string): Passed through to the respective raml2obj option.
  • includeApis (string array): List of allowed API keys (derived from file and folder names)
  • excludeApis (string array): List of denied API keys (derived from file and folder names)
  • annotateConstantLikeEnums (boolean): Adds an additional const attribute with the de-facto constant value of a type whenever it detects enum value arrays that have exactly one entry only.

A typical GraphQL query

Example for reading all types:

{
  allRamlType {
    nodes {
      apiKey
      name
      key
      type
      originalType
      description
      additionalProperties
      properties {
        name
        type
        originalType
        anyOf {
          type
          name
        }
        items {
          type
          name
        }
        description
        required
        format
        enum
        minimum
        maximum
        pattern
        annotations {
          beta
        }
      }
      examples {
        name
        displayName
        description
        value
      }
    }
  }
}

Developing

See docs/developing.md for some helpful information and a reading list.

3.0.2

4 years ago

3.0.1

4 years ago

3.0.1-canary.6

4 years ago

3.0.1-canary.5

4 years ago

3.0.1-canary.4

4 years ago

3.0.1-canary.3

4 years ago

3.0.1-canary.2

4 years ago

3.0.1-canary.1

4 years ago

3.0.0

4 years ago

3.0.1-canary.0

4 years ago

2.5.1-canary.27

4 years ago

2.5.1-canary.26

4 years ago

2.5.1-canary.25

4 years ago

2.5.1-canary.24

4 years ago

2.5.1-canary.23

4 years ago

2.5.1-canary.21

4 years ago

2.5.1-canary.20

4 years ago

2.5.1-canary.19

4 years ago

2.5.1-canary.18

4 years ago

2.5.1-canary.17

4 years ago

2.5.1-canary.15

4 years ago

2.5.1-canary.14

4 years ago

2.5.1-canary.13

4 years ago

2.5.1-canary.11

4 years ago

2.5.1-canary.12

4 years ago

2.5.1-canary.8

4 years ago

2.5.1-canary.7

4 years ago

2.5.1-canary.6

4 years ago

2.5.1-canary.9

4 years ago

2.5.1-canary.10

4 years ago

2.5.1-canary.5

4 years ago

2.5.1-canary.4

4 years ago

2.5.1-canary.3

4 years ago

2.5.1-canary.2

4 years ago

2.5.1-canary.1

4 years ago

2.5.1-canary.0

4 years ago

2.4.1-canary.22

4 years ago

2.5.0

4 years ago

2.4.1-canary.21

4 years ago

2.4.1-canary.20

4 years ago

2.4.1-canary.19

4 years ago

2.4.1-canary.17

4 years ago

2.4.1-canary.18

4 years ago

2.4.1-canary.15

4 years ago

2.4.1-canary.16

4 years ago

2.4.1-canary.14

4 years ago

2.4.1-canary.13

4 years ago

2.4.1-canary.9

4 years ago

2.4.1-canary.10

4 years ago

2.4.1-canary.11

4 years ago

2.4.1-canary.12

4 years ago

2.4.1-canary.8

4 years ago

2.4.1-canary.7

4 years ago

2.4.1-canary.6

4 years ago

2.4.1-canary.4

4 years ago

2.4.1-canary.1

4 years ago

2.4.1-canary.3

4 years ago

2.4.1-canary.2

4 years ago

2.4.1-canary.0

4 years ago

2.3.1-canary.3

4 years ago

2.3.1-canary.1

4 years ago

2.3.1-canary.2

4 years ago

2.3.1-canary.0

4 years ago

2.2.1-canary.1

4 years ago

2.2.1-canary.0

4 years ago

2.1.1-canary.2

4 years ago

2.1.1-canary.1

4 years ago

2.1.0

4 years ago

2.0.1-canary.6

4 years ago

2.1.1-canary.0

4 years ago

2.0.1-canary.4

4 years ago

2.0.1-canary.3

4 years ago

2.0.1-canary.0

4 years ago

1.8.2-canary.2

4 years ago

2.0.0

4 years ago

1.8.2-canary.0

4 years ago

1.8.1-canary.0

4 years ago

1.7.8-canary.2

4 years ago

1.7.8-canary.1

4 years ago

1.7.8-canary.0

4 years ago

1.7.7-canary.5

4 years ago

1.7.7-canary.4

4 years ago

1.7.7-canary.3

4 years ago

1.7.7-canary.2

4 years ago

1.7.7-canary.0

4 years ago

1.7.6-canary.11

4 years ago

1.7.6-canary.10

4 years ago

1.7.6-canary.9

4 years ago

1.0.1-canary.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

1.0.0-canary.36

4 years ago