Skip to content

Latest commit

 

History

History
 
 

client-sdk-publish

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Autogenerated Client SDK Publish template

A sequence of steps to generate and publish a SDK package based on a given OpenAPI spec.

It does the following:

  1. generate models and client code based on a give OpenAPI spec, using @pagopa/openapi-codegen-ts
  2. generate package.json based on main package.json values (like name and version), using @pagopa/openapi-codegen-ts
  3. publish the package on NPM

If the template is executed against a library/application that has @pagopa/openapi-codegen-ts as dependency, the specific version of such package is used; otherwise, the latest version will be fetched from registry. This mechanism supports yarn only, so far.

Please note that there's no need to install dependencies before the template, as no code from the application is executed.

Be sure that this template is called after the main package.json has been updated.

Usage

resources:
  repositories:
    - repository: templates
      type: github
      name: pagopa/azure-devops-templates
      ref: refs/tags/v[n]



stages:
 - ...
 - stage: Release
   ...


  # Publish client SDK to
  - stage: PublishClientSDKtoNPM
    dependsOn: Release
    pool:
      vmImage: 'ubuntu-latest'
    jobs:
      - job: do_generate_and_publish  
        steps:
        # Template for generating and publishing client SDK to NPM
        - template: templates/client-sdk-publish/template.yaml@templates
          parameters:
            openapiSpecPath: 'openapi/index.yaml'

Parameters

param description default required
openapiSpecPath The relative path of the OpenAPI spec from projectDir folder To be defined yes
apiProjectDir The project directory, in case of multi-project repo . no
sdkPackageName The name of the generated package Inherited from the api project's package.json no
generatorPackageName Define the name of the generator package to be used. In most cases, there's no need do edit this parameter @pagopa/openapi-codegen-ts no
npmRegistry Define the url fo the registy to upload the package onto. In most cases, there's no need do edit this parameter https://registry.npmjs.org/ no
artifactName The name of the artifact published in the pipeline space. The artifact is published to allow inspection, however the artifact name is overridable as it may be used in next steps or even jobs. In most cases, there's no need do edit this parameter Bundle_SDK no