mmews-n4 db478c3452
Support language N4JS (2nd) (#15397)
* n4js initial commit

* incorporate feedback from user

* add tests

* fix media type in case of DELETE method

* fix media type

* some minor fixes

* options fix for booleans

* small fixes

* generated files by ./bin/utils/ensure-up-to-date

* remove String::toLowerCase due to de.thetaphi:forbiddenapis

* adjust test expectation

* fix test expectations

* fix test expectation

* add note to section 'Languages/Generators'

* remove file according to review

* replace tabs by spaces

* replace tabs by spaces (2)

* update two generated files

* remove test file

* move statement
2023-05-03 20:50:21 +08:00

1.4 KiB

Documentation for OpenAPI Petstore

  • API version: 1.0.0

This is a sample server Petstore server. For this sample, you can use the api key special-key to test the authorization filters.

Automatically generated by the OpenAPI Generator

Getting started

Configure the following elements:

  • In open-api-n4js.yaml please add under 'additionalProperties':
    • property 'fetchExecuterConstName'
    • property 'fetchExecuterConstImplPath'
  • The generated output directory needs to be augmented with an implementing n4js file

Example

open-api-n4js.yaml

    generatorName: n4js
    outputDir: /working_dir/gen-n4js/
    inputSpec: /working_dir/api-spec/main.yaml
    templateDir: /openapi-generator/modules/openapi-generator/src/main/resources/n4js
    additionalProperties:
      fetchExecuterConstName: "FETCH_EXEC"
      fetchExecuterConstImplPath: "FetchExecuterImpl"

FetchExecuterImpl.n4js

    import {FetchExecuterI} from "api/ApiHelper";

    export public const FETCH_EXEC = new FetchExecuterMock();

    export public class FetchExecuterMock implements FetchExecuterI {
        @Override
        public async run(
            path: string,
            query: ~Object=,
            reqInit: ~Object= {}): ~Object with {get status() : number, json(): Promise<any>} {

            return null;
        }
    }