swagger-editor icon indicating copy to clipboard operation
swagger-editor copied to clipboard

SwaggerEditor@next: not clearing default content link/url

Open laughingbiscuit opened this issue 3 years ago • 1 comments

Q&A (please complete the following information)

  • OS: Android 12
  • Browser: chrome 108.0.5359.128
  • Version: whatever version editor-next.swagger.io is at time of raising
  • Method of installation: n/a
  • Swagger-Editor version: 5.0.0-alpha41
  • Swagger/OpenAPI version: OpenAPI 3.0

Content & configuration

Example Swagger/OpenAPI definition:

openapi: 3.0.2
info:
  title: Fruit API
  version: "1.0"
  license:
    name: MIT
   # we should standardise this
servers:
  - url: https://api.example.com/fruit/v1

paths:
  /apples:
    get:
      summary: List all apples
      operationId: listApples
      tags:
      - apples
      parameters:
      - name: offset
        in: query
        description: Starting index returned
        schema:
          type: integer
          maximum: 100
        # we should standardise descriptions of common fields
      - name: limit
        in: query
        description: Maximum length of results returned
        schema:
          type: integer
          maximum: 100
      - name: colour
        in: query
        description: Primary colour of apple
        schema:
          $ref: "#/components/schemas/AppleColour"
      responses:
        200:
          description: A paged array of apples
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Apples"

components:
  schemas:
    AppleColour:
      type: string
      enum:
      - "green"
      - "red"
    Apple:
      type: object
      required:
        - id
        - description
        - colour
      properties:
        id:
          type: integer
          format: int
        description:
          type: string
        colour:
          $ref: "#/components/schemas/AppleColour"
    Apples:
      type: array
      maxItems: 50
      items:
        $ref: "#/components/schemas/Apple"
    Error:
      type: object
      required:
        - code
        - type
        - description
      properties:
        code:
          type: integer
          format: int
        type:
          type: string
        description:
          type: string  
  



Swagger-Editor configuration options:

whatever is deployed to the site EDIT: 5.0.0-alpha41 is shown on load

Describe the bug you're encountering

When loading editor-next.swagger.io the first time, a kafka streetlight example is shown. When I replace the specification with my own, the rendered version is updated expected for a URL which is leftover.

To reproduce...

Steps to reproduce the behavior:

  1. Go to editor-next.swagger.io in incognito mode
  2. Replace specification yaml in left panel with the above specification (or any)
  3. Note that the rendered updates on the right
  4. Note that the kafka streetlight github URL is still shown

Expected behavior

There should be no reference to streetlight API

Screenshots

Screenshot_20221221-211036_Chrome~2

Additional context or thoughts

Unsure if this is mobile only, however setting the browser to 'desktop mode' doesn't help.

laughingbiscuit avatar Dec 21 '22 21:12 laughingbiscuit

Just to add more context to this:

URL stays there when Editor -> Clear is triggered. File -> Load Example as well. Basically the URLs stays there for the entire lifetime of the SwaggerEditor@5.

SwaggerEditor@4 doesn't use url information at all. SwaggerEditor@5 should reflect behavior of SwaggerEditor@4.

char0n avatar Feb 14 '23 14:02 char0n