Skip to content

How to generate code samples? Where are the plugins #14

Open
@ghost

Description

I am trying to generate code samples and I am getting the following message:

Adding code samples to spec
Running plugins
Plugins folder not found. Skip.

Would be great if someone could explain where to find the plugins and how to add them?

Thanks!

Activity

RomanHotsiy

RomanHotsiy commented on Aug 9, 2017

@RomanHotsiy
Member

Hey @DataTigerGitHub,
There is no feature to automatically generate code samples right now.
Adding code samples to spec steps adds samples from spec/code_samples folder in your repo.
Just add them according to the README file in this folder.

Use sample repo for the reference.

As for Running plugins message, it is not related to code samples thing and it's ok.

ghost
ghost
RomanHotsiy

RomanHotsiy commented on Aug 17, 2017

@RomanHotsiy
Member

IF you use generator-openapi-repo then you just have to put your snippets into correct folders:
<lang>/<path>/<HTTP verb>.<extension> where <path> is the method path.

To bundle your snippets into single spec just run: npm run build and you will get your bundled file in web_deploy/swagger.json

jgabriels

jgabriels commented on Mar 3, 2018

@jgabriels

I have a fully working code generator:
https://github.com/Direct-Freight/df-api-docs/blob/master/scripts/generate-code-samples.js
It's called during the build:
https://github.com/Direct-Freight/df-api-docs/blob/master/scripts/build.js
You can see what the final results looks like here:
http://apidocs.directfreight.com/#tag/boards
I created a pull request here: #18
but haven't tested it on any third party definitions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @RomanHotsiy@jgabriels

        Issue actions

          How to generate code samples? Where are the plugins · Issue #14 · Redocly/create-openapi-repo