spectral icon indicating copy to clipboard operation
spectral copied to clipboard

Can't export rightly output with docker image

Open prousso opened this issue 3 years ago • 2 comments

Describe the bug When I want to export output with docker image (same result with latest or master) I got all espace sequences when there are error in my specification

To Reproduce

  1. Given this OpenAPI/AsyncAPI document :
openapi: "3.0.0"
info:
  version: 1.0.0
  title: Swagger Petstore
  license:
    name: MIT
servers:
  - url: http://petstore.swagger.io/v1
paths:
  /pets:
      summary: List all pets
      operationId: listPets
      tags:
        - pets
      parameters:
        - name: limit
          in: query
          description: How many items to return at one time (max 100)
          required: false
          schema:
            type: integer
            format: int32
      responses:
        '200':
          description: A paged array of pets
          headers:
            x-next:
              description: A link to the next page of responses
              schema:
                type: string
          content:
            application/json:    
              schema:
                $ref: "#/components/schemas/Pets"
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

components:
  schemas:
    Pet:
      type: object
      required:
        - id
        - name
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string
        tag:
          type: string
    Pets:
      type: array
      items:
        $ref: "#/components/schemas/Pet"
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
  1. Run this CLI command docker run --rm -t -v $(pwd):/app -v /tmp:/tmp stoplight/spectral:master lint --fail-severity error --display-only-failures --verbose --output /tmp/cactus -e utf8 app/my_file.yaml '
  2. See error with escape sequences

Expected behavior Like in CLI I only want to print error instead of [31merror[39m

Environment (remove any that are not applicable):

  • Library version: docker image master or latest, cli 5.9.0

prousso avatar Apr 06 '21 15:04 prousso

Docker images currently don't have the latest version. Possibly will be fixed with #1479

mnaumanali94 avatar Apr 27 '21 10:04 mnaumanali94

We think this is related to the CLI coloring scheme being written to an output file.

raleigh04 avatar May 24 '21 15:05 raleigh04