Mustache template pre Swagger-codegen static-docs

Programovacie jazyky, rady, poradňa...
lecka159357
Novice
Novice
Príspevky: 4
Registrovaný: 23 apr 2010, 14:21

Mustache template pre Swagger-codegen static-docs

Príspevok od používateľa lecka159357 »

Ahojte,

snazim sa vygenerovat statickú HTML dokumentaciu pomocou https://github.com/swagger-api/swagger-codegen.

Mám základný Mustache template, ktorý je v projekte, avsak ked ho chcem pouzit, tak mi vsetky REST API hodi do jedneho (nie ako v example PetApi, UserApi ...).

Taktiež by som rad pridal nejaké parametre z JSONu (napriklad ResponseMessages) a potreboval by som aj nejak zadefinovat model pre List(array) a podobne veci (z niektorych premennych tohto typu mi model nevytvorí).

Nechcel som to tu zahltit vsetkymi tymi subormi, takze Mustache templaty najdete tu:https://github.com/swagger-api/swagger- ... ger-static.

Môj JSON vyzerá následovne:
Zakladny JSON vrateny z swagger/api-docs:

Kód: Vybrať všetko

{
  "apiVersion": "1.0",
  "swaggerVersion": "1.2",
  "apis": [
    {
      "path": "/default/countries",
      "description": "aaaa"
    },
    {
      "path": "/default/gateways",
      "description": "xxxxxxxxxxxxx"
    },
    {
      "path": "/default/location",
      "description": "aaaaaaaaaaaaaa"
    },
    {
      "path": "/default/mccs",
      "description": "Osaasdasasds"
    },
    {
      "path": "/default/merchants",
      "description": "Opesdaadsadsdasnts"
    },
    {
      "path": "/default/partners",
      "description": "Ogaseerers"
    },
    {
      "path": "/default/payments",
      "description": "gaeagees"
    },
    {
      "path": "/default/resources",
      "description": "Ofasdfaeewefs"
    },
    {
      "path": "/default/terminals",
      "description": "Opwettwraegettwls"
    },
    {
      "path": "/default/terminalsubsetdefaultresourceset",
      "description": "Orzrateat"
    },
    {
      "path": "/default/users",
      "description": "aefefrs"
    }
  ],
  "info": {
    "title": "App API",
    "description": "",
    "termsOfServiceUrl": "",
    "contact": "",
    "license": "",
    "licenseUrl": ""
  }
}

JSON pre konkretne countries API:

Kód: Vybrať všetko

{
  "apiVersion": "1.0",
  "swaggerVersion": "1.2",
  "basePath": "/xxxx-server",
  "resourcePath": "/v1",
  "apis": [
    {
      "path": "/v1/countries",
      "description": "findAllCountries",
      "operations": [
        {
          "method": "GET",
          "summary": "aaa",
          "notes": "It filtering",
          "type": "array",
          "items": {
            "$ref": "Country"
          },
          "nickname": "findAllCountries",
          "parameters": [
            {
              "name": "partnerId",
              "description": "Paasfiltering.",
              "defaultValue": "",
              "required": true,
              "type": "string",
              "paramType": "query",
              "allowMultiple": false
            },
            {
              "name": "vendor",
              "description": "Veasdfor filtering.",
              "defaultValue": "",
              "required": true,
              "type": "string",
              "paramType": "query",
              "allowMultiple": false
            },
            {
              "name": "model",
              "description": "Modasdfe for filtering.",
              "defaultValue": "",
              "required": true,
              "type": "string",
              "paramType": "query",
              "allowMultiple": false
            }
          ],
          "responseMessages": [
            {
              "code": 200,
              "message": "OK",
              "responseModel": "List"
            },
            {
              "code": 403,
              "message": "Forbidden"
            },
            {
              "code": 401,
              "message": "Unauthorized"
            },
            {
              "code": 404,
              "message": "Not Found"
            }
          ],
          "deprecated": "false"
        }
      ]
    },
    {
      "path": "/v1/country",
      "description": "ggasdgdsatries",
      "operations": [
        {
          "method": "GET",
          "summary": "Get all countries",
          "notes": "Get all ssdgagrictions.",
          "type": "array",
          "items": {
            "$ref": "Country"
          },
          "nickname": "getAllCountries",
          "parameters": [],
          "responseMessages": [
            {
              "code": 200,
              "message": "OK",
              "responseModel": "List"
            },
            {
              "code": 403,
              "message": "Forbidden"
            },
            {
              "code": 401,
              "message": "Unauthorized"
            },
            {
              "code": 404,
              "message": "Not Found"
            }
          ],
          "deprecated": "false"
        }
      ]
    }
  ],
  "models": {
    "Country": {
      "id": "Country",
      "description": "The Country",
      "extends": "",
      "properties": {
        "code": {
          "type": "string",
          "description": "sdfe"
        },
        "name": {
          "type": "string",
          "description": "Csdfasfme"
        }
      }
    }
  }
}
Vedel by ma niekto aspon usmernit, ktore casti tohto projektu mam upravit / maju do nieco spolocne s generovanim static-docs, aby som vedel vygenerovat aj ResponseCodes, Response Messages a prip. zadefinoval novy model pre tie ArrayListy?

Dakujem uz vopred.
Napísať odpoveď