Skip to content

[API-Processor] Support export build tasks #10

@iugaidiana

Description

@iugaidiana

Now export of artifacts that require some data transformation will be handled by api-processor. So, it is needed to support the following build types (https://github.com/Netcracker/qubership-apihub-backend/blob/4838cb293e8e344166f2bf8f1fc93889b5b51f83/docs/api/Public%20Registry%20API.yaml#L8066):

  1. exportVersion. The option exports all documents from the version of package (not available for dashboard). The resulting file of such export is ZIP file:
    1. if package version has no OpenAPI specification (i.e. documents with type types openapi-3-1, openapi-3-0, or openapi-2-0), then ZIP contains:
      • all documents (in raw format) from package version
    2. if package version has OpenAPI specification(s), then ZIP contains:
      • if format = html:
        • all documents (in raw format) from package version, which are not OpenAPI specifications
        • OpenAPI specification file(s) in HTML format
        • index.html file which shows table of contents with all OpenAPI specifications
        • ls.html file with legal statement
        • resources folder with corporatelogo.png and style.css
      • if format = yaml:
        • all documents (in raw format) from package version, which are not OpenAPI specifications
        • OpenAPI specification file(s) in yaml format
      • if format = json:
        • all documents (in raw format) from package version, which are not OpenAPI specifications
        • OpenAPI specification file(s) in json format
    • If multiple files have the same name, a postfix " N" will be added, where N is 1, 2, 3, etc., for each duplicate file name.
  2. exportRestDocument. The option exports one openapi document in yaml, json or html format.
    1. if html format is selected, then resulting file of such export is ZIP file with the following files:
      • OpenAPI specification file in HTML format
      • index.html file which shows table of contents.
      • ls.html file with legal statement
      • resources folder with corporatelogo.png and style.css
    2. if yaml or json format is selected, then resulting file of such export is single file in the appropriate yaml/json format.
  3. exportRestOperationsGroup. The option exports one operations group with rest api type in reducedSourceSpecifications or mergedSpecification view.
    1. if reducedSourceSpecifications is selected, then result of such export is:
      • if format = html, then the resulting file is ZIP file with the following files:
        • reduced sources OpenAPI specification files in HTML format.
        • index.html file which shows table of contents.
        • ls.html file with legal statement
        • resources folder with corporatelogo.png and style.css
      • if format = yaml, then the resulting file is ZIP file with the following files:
        • reduced sources OpenAPI specification files in yaml format.
      • if format = json, then the resulting file is ZIP file with the following files:
        • reduced sources OpenAPI specification files in json format.
      • if operations group is from dashboard, then each OAS files must have "packageId" prefix in file name, i.e. <packageId>_<filename>.html (related issue [FE][Improvement] Download Reduced source specs of Oper groups - add prefix for specs names qubership-apihub#22 ).
      • If operations group is from package and If multiple files have the same name, a postfix " N" will be added, where N is 1, 2, 3, etc., for each duplicate file name.
    2. if mergedSpecification is selected, then result of such export is:
      • if format = html, then the resulting file is ZIP file with the following files:
        • merged OpenAPI specification file in HTML format
        • index.html file which shows table of contents.
        • ls.html file with legal statement
        • resources folder with corporatelogo.png and style.css
    • if format = yaml then the resulting file is merged OpenAPI specification file in yaml format.
    • if format = json then the resulting file is merged OpenAPI specification file in json format.

exportVersion, exportRestDocument, exportRestOperationsGroup build types shall support removeOasExtensions option (Netcracker/qubership-apihub-api-unifier#6)

Mapping of builType to format:

  html yaml json
exportVersion x x
exportRestDocument x x x
exportRestOperationsGroup x x x

Mapping of builType to transformation options:

  operationsSpecTransformation (reducedSourceSpecifications / mergedSpecification) removeOasExtensions
exportRestVersion   x
exportRestDocument   x
exportRestOperationsGroup x x

Sub-issues

Metadata

Metadata

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions