Skip to content

example is used for example for Schema Object examples (instead of examples) #698

Closed as not planned

Description

@aborg0

Describe the bug

At Schema Object examples Model with Example the examples (JSON and also the YAML) use example, but the previous part of the specification suggests that examples can be used. The tooling seems to support examples, but not example.
Discussion: https://asyncapi.slack.com/archives/CQVJXFNQL/p1642787250166800

To Reproduce

Steps to reproduce the behavior:

  1. Create a document with example.
  2. Try to change to 'examples' and make it a list.
  3. Try to validate the document doing 'studio' for example
  4. The studio does not render the example, but it does the examples

Expected behavior

I expect to support examples (/), and at least does not provide an example with example, maybe that can be disallowed in the spec too to avoid confusion (though that can be hard to defend as the schema can have extra keys).

Sample document

Example fragmentss I think we should not have:

{
  "type": "object",
  "properties": {
    "id": {
      "type": "integer",
      "format": "int64"
    },
    "name": {
      "type": "string"
    }
  },
  "required": [
    "name"
  ],
  "example": {
    "name": "Puma",
    "id": 1
  }
}
type: object
properties:
  id:
    type: integer
    format: int64
  name:
    type: string
required:
- name
example:
  name: Puma
  id: 1

Proper example fragments should look like this in my opinion:

{
  "type": "object",
  "properties": {
    "id": {
      "type": "integer",
      "format": "int64"
    },
    "name": {
      "type": "string"
    }
  },
  "required": [
    "name"
  ],
  "examples": [
     {
       "name": "Puma",
       "id": 1
     }
  ]
}
type: object
properties:
  id:
    type: integer
    format: int64
  name:
    type: string
required:
- name
examples:
  -
    name: Puma
    id: 1

Activity

  1. github-actions commented on Jan 21, 2022

    @github-actions

    Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
    Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

  2. derberg commented on Jan 24, 2022

    @derberg
    Member

    oh this is weird that nobody yet noticed it 🤔 even though I think I had a related discussion with someone some day
    😅

    thanks a lot, feel free to open a PR to adjust it there in the spec 🙏🏼

  3. added a commit that references this issue on Jan 26, 2022
    26ee4f7
  4. github-actions commented on May 25, 2022

    @github-actions

    This issue has been automatically marked as stale because it has not had recent activity 😴

    It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

    There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

    Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

    Thank you for your patience ❤️

  5. github-actions commented on Nov 27, 2022

    @github-actions

    This issue has been automatically marked as stale because it has not had recent activity 😴

    It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

    There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

    Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

    Thank you for your patience ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions