anz-bank / sysl

Sysl (pronounced "sizzle") is a system specification language
https://sysl.io
Apache License 2.0
122 stars 42 forks source link

Sysl export issue on description #940

Open ericzhang6222 opened 4 years ago

ericzhang6222 commented 4 years ago

Please do not post any internal, closed source snippets on this public issue tracker!

Description

Export openapi3 file from Sysl file

sysl export --format="openapi3" --output="%(appname).yaml" simple-openapi3.sysl

simple-openapi3.sysl

SimpleOpenAPI3 "SimpleOpenAPI3":
    @description =:
        | Simple demo for openapi file export

    /test:
        GET:
            | Endpoint for testing GET
            return error
            return ok <: SimpleObj

    #---------------------------------------------------------------------------
    # definitions

    !type SimpleObj:
        name <: string?:
            @json_tag = "name"

    !type SimpleObj2:
        name <: SimpleObj?:
            @json_tag = "name"

SimpleOpenAPI3.yaml

components:
  schemas:
    SimpleObj:
      properties:
        name:
          type: string
      type: object
    SimpleObj2:
      properties:
        name:
          $ref: '#/components/schemas/SimpleObj'
      type: object
info:
  contact: {}
  description: |
    Simple demo for openapi file export
  title: SimpleOpenAPI3
  version: ""
openapi: 3.0.0
paths:
  /test:
    get:
      description: Endpoint for testing GET
      responses:
        "200":
          content:
            application/json: {}
          description: "200"
servers:
- url: ""

Expected behavior:

info:
  contact: {}
  description: Simple demo for openapi file export
  title: SimpleOpenAPI3
  version: ""

Actual behavior:

info:
  contact: {}
  description: |
    Simple demo for openapi file export
  title: SimpleOpenAPI3
  version: ""

Your Environments

$ sysl info
Build:
  Version      : v0.136.0
  Git Commit   : 9d1dc564c36b273b09cbc68b7a1c4c1c42ea991e
  Date         : 2020-07-06T06:56:22Z
  Go Version   : go1.13.12 linux/amd64
  OS           : darwin/amd64
$ sysl env
SYSL_MODULES=""
SYSL_PLANTUML="http://localhost:8080"