Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Add More Spec Details to the UI #378

Open
12 of 36 tasks
jenarp opened this issue Sep 29, 2023 · 11 comments · Fixed by #578 or #692
Open
12 of 36 tasks

Enhancement: Add More Spec Details to the UI #378

jenarp opened this issue Sep 29, 2023 · 11 comments · Fixed by #578 or #692
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@jenarp
Copy link

jenarp commented Sep 29, 2023

Description:
I've noticed that certain Swagger documentation annotations, notably 'minimum' and 'maximum', are present in the specification but are not reflected in the UI. Additionally, payloads with primitive types like 'string' don't have their type explicitly displayed in the UI.

Steps to Reproduce:

  1. Add annotations like 'minimum' or 'maximum' to your Schema Annotation or use a primitive type as payload.
  2. Verify they appear in the specification and note that 'type: string' (or similar) is present.
  3. Observe the absence of these details in the UI.

Expected Behavior:
Swagger annotations, such as 'minimum' and 'maximum', would be a valuable addition to the UI. It would also be beneficial for the UI to display primitive types explicitly.

Actual Behavior:
Annotations are missing, and primitive types are not distinctly represented.

Suggested Fix:

Enhance the UI to incorporate Swagger annotations more comprehensively.
Display primitive payload types clearly.
Aim for parity with the display capabilities of the AsyncAPI React component.

Status:

  • Const
  • Enum
  • Items
  • MaxItems
  • MinItems
  • Required
  • name: String (default: "")
  • title: String (default: "")
  • multipleOf: double (default: 0.0)
  • maximum: String (default: "")
  • exclusiveMaximum: boolean (default: false)
  • minimum: String (default: "")
  • exclusiveMinimum: boolean (default: false)
  • maxLength: int (default: Integer.MAX_VALUE)
  • minLength: int (default: 0)
  • pattern: String (default: "")
  • maxProperties: int (default: 0)
  • minProperties: int (default: 0)
  • requiredProperties: String[] (default: {})
  • requiredMode: Schema.RequiredMode (default: Schema.RequiredMode.AUTO)
  • description: String (default: "")
  • format: String (default: "")
  • ref: String (default: "")
  • nullable: boolean (default: false)
  • example: String (default: "")
  • externalDocs: ExternalDocumentation (default: @ExternalDocumentation)
  • deprecated: boolean (default: false)
  • type: String (default: "")
  • allowableValues: String[] (default: {})
  • defaultValue: String (default: "")
  • discriminatorProperty: String (default: "")
  • hidden: boolean (default: false)
  • enumAsRef: boolean (default: false)
  • types: String[] (default: {})
  • exclusiveMaximumValue: int (default: 0)
  • exclusiveMinimumValue: int (default: 0)
@jenarp jenarp added the enhancement New feature or request label Sep 29, 2023
@timonback timonback added the good first issue Good for newcomers label Oct 3, 2023
@aerfus
Copy link
Contributor

aerfus commented Dec 23, 2023

Hello,
@jenarp , @timonback let me try to accomplish this one.

AsyncAPI Studio -> https://studio.asyncapi.com/
shows minimum and maximum values as follows:
minimum_maximum_example

Need to display in a similar way, right?

@timonback
Copy link
Member

timonback commented Dec 23, 2023

Hi @aerfus ,
sure, thank you for volunteering.
Feel free to take inspiration from asyncapi studio and get creative :)

In case you plan larger changes, it might be easier for us, when you start from the branch feat/asyncapi-3 as it contains some ui refactorings.

The schema component could be a good starting point.
In case you have any questions, you are welcome to comment here on GH or ask on Discord.

@aerfus
Copy link
Contributor

aerfus commented Dec 28, 2023

Hi @timonback,

I've added types to payloads headers
and example for primitive types.
Currently working on maximum and minimum values.

P.S. using feat/asyncapi-3

new_schemas_presentation

aerfus added a commit to aerfus/springwolf-core that referenced this issue Dec 31, 2023
aerfus added a commit to aerfus/springwolf-core that referenced this issue Dec 31, 2023
aerfus added a commit to aerfus/springwolf-core that referenced this issue Dec 31, 2023
aerfus added a commit to aerfus/springwolf-core that referenced this issue Dec 31, 2023
 No intuitive way to check whether the payload is an objects or a string

Refs springwolf#378
aerfus added a commit to aerfus/springwolf-core that referenced this issue Dec 31, 2023
aerfus added a commit to aerfus/springwolf-core that referenced this issue Dec 31, 2023
Feature request.
Only properties has info displayed

Refs springwolf#378
aerfus added a commit to aerfus/springwolf-core that referenced this issue Dec 31, 2023
@aerfus
Copy link
Contributor

aerfus commented Dec 31, 2023

Dev test

Screenshot 1
image
Screenshot 2
image

aerfus added a commit to aerfus/springwolf-core that referenced this issue Jan 1, 2024
To visualize in UI

Refs springwolf#378

test(kafka): add primitive types

More data to demonstrate + type badges check
aerfus added a commit to aerfus/springwolf-core that referenced this issue Jan 1, 2024
aerfus added a commit to aerfus/springwolf-core that referenced this issue Jan 1, 2024
 No intuitive way to check whether the payload is an objects or a string

Refs springwolf#378
aerfus added a commit to aerfus/springwolf-core that referenced this issue Jan 1, 2024
aerfus added a commit to aerfus/springwolf-core that referenced this issue Jan 1, 2024
Feature request.
Only properties has info displayed

Refs springwolf#378
aerfus added a commit to aerfus/springwolf-core that referenced this issue Jan 1, 2024
aerfus added a commit to aerfus/springwolf-core that referenced this issue Jan 1, 2024
To visualize in UI

Refs springwolf#378

test(kafka): add primitive types

More data to demonstrate + type badges check
aerfus added a commit to aerfus/springwolf-core that referenced this issue Jan 1, 2024
aerfus added a commit to aerfus/springwolf-core that referenced this issue Jan 1, 2024
 No intuitive way to check whether the payload is an objects or a string

Refs springwolf#378
aerfus added a commit to aerfus/springwolf-core that referenced this issue Jan 1, 2024
aerfus added a commit to aerfus/springwolf-core that referenced this issue Jan 1, 2024
Feature request.
Only properties has info displayed

Refs springwolf#378
aerfus added a commit to aerfus/springwolf-core that referenced this issue Jan 1, 2024
timonback pushed a commit that referenced this issue Jan 2, 2024
* test: ignore line ending in generated specs assertions

Is failing in Windows OS

Refs #378

* refactor(kafka): add primitive payload, example of `minimum` value

To visualize in UI

Refs #378

test(kafka): add primitive types

More data to demonstrate + type badges check

* refactor(ui): add schema properties template

To reuse for primitive types

Refs #378

* feat(ui): add `type` badge to schema payload header

 No intuitive way to check whether the payload is an objects or a string

Refs #378

* feat(ui): add minimum and maximum values to the spec`s model

Feature request

Refs #378

* feat(ui): display primitive type info

Feature request.
Only properties has info displayed

Refs #378

* feat(ui): display minimum and maximum values

Feature request.

Refs #378

* Revert "test: ignore line ending in generated specs assertions"

This reverts commit 07a6b30.
timonback pushed a commit that referenced this issue Jan 2, 2024
* test: ignore line ending in generated specs assertions

Is failing in Windows OS

Refs #378

* refactor(kafka): add primitive payload, example of `minimum` value

To visualize in UI

Refs #378

test(kafka): add primitive types

More data to demonstrate + type badges check

* refactor(ui): add schema properties template

To reuse for primitive types

Refs #378

* feat(ui): add `type` badge to schema payload header

 No intuitive way to check whether the payload is an objects or a string

Refs #378

* feat(ui): add minimum and maximum values to the spec`s model

Feature request

Refs #378

* feat(ui): display primitive type info

Feature request.
Only properties has info displayed

Refs #378

* feat(ui): display minimum and maximum values

Feature request.

Refs #378

* Revert "test: ignore line ending in generated specs assertions"

This reverts commit 07a6b30.
@timonback
Copy link
Member

timonback commented Jan 2, 2024

@jenarp @aerfus As the first PR is merged, lets move the conversation to the issue.

Thank you @aerfus for adding maximum and minimum fields to springwolf-ui.


@jenarp Can you add a list of fields that you are interested in?

Based on the json-schema JsonSchemaGeneration I can imagine the following fields:

  • Const
  • Description
  • Enum
  • Nullable
  • Format
  • Items
  • Maximum
  • Minimum
  • MaxItems
  • MinItems
  • MaxLength
  • MinLength
  • MultipleOf
  • Name
  • Pattern
  • Required
  • Title
  • Type

( I believe when you copy this checkbox list to the issue description, Github views this as a checklist, which provides clarity on what is still missing.)

@jenarp
Copy link
Author

jenarp commented Jan 3, 2024

Yes, examining the JSON schema is beneficial!
Swagger uses this as well.
When you look into the Swagger Schema within the library io/swagger/core/v3/swagger-annotations-jakarta/2.2.16/swagger-annotations-jakarta-2.2.16, particularly at package io.swagger.v3.oas.annotations.media, you'll find a comprehensive list of annotations used to define the schema. Here’s a list of interesting fields (not exhaustive) from the Schema annotation, including those from your list that weren't duplicates:

  • Const
  • Enum
  • Items
  • MaxItems
  • MinItems
  • Required
  • name: String (default: "")
  • title: String (default: "")
  • multipleOf: double (default: 0.0)
  • maximum: String (default: "")
  • exclusiveMaximum: boolean (default: false)
  • minimum: String (default: "")
  • exclusiveMinimum: boolean (default: false)
  • maxLength: int (default: Integer.MAX_VALUE)
  • minLength: int (default: 0)
  • pattern: String (default: "")
  • maxProperties: int (default: 0)
  • minProperties: int (default: 0)
  • requiredProperties: String[] (default: {})
  • requiredMode: Schema.RequiredMode (default: Schema.RequiredMode.AUTO)
  • description: String (default: "")
  • format: String (default: "")
  • ref: String (default: "")
  • nullable: boolean (default: false)
  • example: String (default: "")
  • externalDocs: ExternalDocumentation (default: @ExternalDocumentation)
  • deprecated: boolean (default: false)
  • type: String (default: "")
  • allowableValues: String[] (default: {})
  • defaultValue: String (default: "")
  • discriminatorProperty: String (default: "")
  • hidden: boolean (default: false)
  • enumAsRef: boolean (default: false)
  • types: String[] (default: {})
  • exclusiveMaximumValue: int (default: 0)
  • exclusiveMinimumValue: int (default: 0)

This list includes both the original fields you provided and the additional ones that were not duplicates.
It’s important to note that this list may not be exhaustive!

aerfus added a commit to aerfus/springwolf-core that referenced this issue Jan 21, 2024
aerfus added a commit to aerfus/springwolf-core that referenced this issue Jan 21, 2024
For further extensions and maintenance

Refs springwolf#378
aerfus added a commit to aerfus/springwolf-core that referenced this issue Jan 21, 2024
For further extensions and maintenance

Refs springwolf#378
aerfus added a commit to aerfus/springwolf-core that referenced this issue Jan 21, 2024
For further extensions and maintenance

Refs springwolf#378
aerfus added a commit to aerfus/springwolf-core that referenced this issue Jan 21, 2024
timonback pushed a commit that referenced this issue Jan 21, 2024
* feat(ui): add exclusiveMinimum and exclusiveMaximum values to the spec`s model
Feature request

Refs #378

* refactor(ui): reimplement range temple model

For further extension

Refs #378

* feat(ui): add support for exclusiveMinimum and exclusiveMaximum

Feature request

Refs #378

* refactor(ui): separate schema range as a component

For further extensions and maintenance

Refs #378

* test: add exclusiveMinimum to example Dto

To test changes visually

Refs #378
@aerfus
Copy link
Contributor

aerfus commented Jan 23, 2024

Hi @timonback ,
I've started working on tests for schema.component.ts.
Checkout was from timonback:test/add-jest-testing-to-springwolf-ui

timonback added a commit that referenced this issue Jan 26, 2024
* feat(ui): prepare springwolf for AsyncApi 3.0 (wip)

feat(ui): remove testing code

feat(ui): remove asyncApi 2.0 hint about publish/subscribe

feat(ui): add parsing error boundary

feat(ui): add license chip

feat(ui): add notification.service.ts

feat(ui): rename Channel to ChannelOperation

also fix bindings

feat(ui): update asyncapi mapper (wip)

feat(ui): add todos

feat(ui): update asyncapi models to v3

chore(ui): split model packages

chore(ui): download asyncapi document only once

refactor(ui): re-organize components

chore(ui): use asyncapi v3 mock

chore(ui): remove IE support

chore(ui): move favicon.ico to assets

* feat(asyncapi): update package description

* feat(asyncapi): add todos

* Enhancement: Add More Spec Details to the UI (#517)

* test: ignore line ending in generated specs assertions

Is failing in Windows OS

Refs #378

* refactor(kafka): add primitive payload, example of `minimum` value

To visualize in UI

Refs #378

test(kafka): add primitive types

More data to demonstrate + type badges check

* refactor(ui): add schema properties template

To reuse for primitive types

Refs #378

* feat(ui): add `type` badge to schema payload header

 No intuitive way to check whether the payload is an objects or a string

Refs #378

* feat(ui): add minimum and maximum values to the spec`s model

Feature request

Refs #378

* feat(ui): display primitive type info

Feature request.
Only properties has info displayed

Refs #378

* feat(ui): display minimum and maximum values

Feature request.

Refs #378

* Revert "test: ignore line ending in generated specs assertions"

This reverts commit 07a6b30.

* feat: Replaced usage of jAsyncAPI by the new springwolf-asyncapi module (#523)

* feat: Replaced usage of jAsyncAPI by the new springwolf-asyncapi module

We migrate from jAsyncAPI, with support for AsyncAPI v2, to the new SpringWolf-AsyncAPI module, which supports AsyncAPI v3.

This PR is only a first step. Plenty of tests are still not working and others are partially commented.

Please take a look to the multiple FIXMEs in the code

* Replaced Springwolf-Core Message related classes by their Springwolf-AsyncAPI equivalent. (#527)

Fixes some FIXMEs and removes duplicated classes

* AsyncAPI v3 Migration Fixes (#533)

* fix: Multiple fixes related with Channel Messages

Some of the tests are failing due to some AssertJ recursion issue. Help is welcome

* fix: Minor properties fixes

* fix: Fixes to AMQP

Some fixes to the AMQP plugin and example (Still not finished)

* fix: Minor properties fixes

* fix: Migrated asyncapi.json examples to v3

* fix: Migration to AsyncAPI v3

As per https://www.asyncapi.com/docs/migration/migrating-to-v3

For a channel with multiple messages, you specify multiple key-value pairs. For a channel with just one message, you use a single key-value pair.

That means that the use of 'oneOf' is removed.

* fix: Improved support for Channel Messages

Fixed different bugs and limitations with the publishing of Messages in a Channel with the AsyncAPI v3 spec

* fix: Fixed Channel Merger

When merging Channels, the messages were not merged. This is now fixed.

* fix: Added basic support for Operations

Still plenty of errors, but Operations are now appearing in the AsyncAPI v3 output.

* fix: AsyncAPI module test

* Feat/asyncapi v3 UI fixes (#539)

* fix: Added missing comparison code

Those missing annotations were causing some
tests to fail

* fix: AMQP operation binding

As per documentation, 'deliveryMode' can only be 1 or 2. The default value 0 was incorrect

* fix: Added Channel Ref to Operation

* test: update asyncapi.json files based on current state in the branch

Generate asyncapi.actual.json files by running in _springwolf_examples_ folder:

`../gradlew test --tests "**.ApiIntegrationTest" --continue`

* test(kafka): update asyncapi model

* feat(ui): move asyncapi v3 changes

---------

Co-authored-by: Carlos Tasada <ctasada@gmail.com>

* fix: Fixed core tests (#540)

* fix: Fixed core tests

Fixed the failing tests after migrating to AsyncAPI v3

* fix: Fixed AMQP integration

The AMQP was adding both 'exchange' & 'queue' keys, but it should only include the
one related with the binding type.

Also, deliveryMode can be ONLY 1 or 2, the
default value 0 which was used in different places is wrong.

* fix: Fixed AMQP integration

The AMQP was adding both 'exchange' & 'queue' keys, but it should only include the
one related with the binding type.

Also, deliveryMode can be ONLY 1 or 2, the
default value 0 which was used in different places is wrong.

* Feat/message as component (#541)

* feat: move messages to components

* feat: add ChannelMessageReference

allows to link from an operation to the message within a specific channel

* chore: update asyncapi.json

* feat(ui): update after message was moved to components

* fix(ui): map operation binding correctly

* feat(core): remove ChannelMessageReference

* test(example): simplify creation of asyncapi.json files

* test(asyncapi): change channel messages type back to Message

* refactor(asyncapi): rename MessageReference static message

Better indicate what the reference points to

* chore: spotless

* test: fix DefaultChannelsServiceIntegrationTest

* test(kafka): remove duplicated primitite-topic consumer

* feat(core): use AsyncApi 3.0 OperationAction

* feat(ui): show contact info

* chore: update dependency list

* Different fixes in the asyncapi v3 spec examples (#543)

* fix: Minor fix to core spec example

The asyncapi test sample had a minor issue when validated with https://studio.asyncapi.com/

* fix: Minor fix to sns-plugin spec example

The asyncapi test sample had a minor issue when validated with https://studio.asyncapi.com/

We need to properly configure those values, something that I will take care of in the next PR

* fix: Minor fix to sqs-plugin spec example

The asyncapi test sample had a minor issue when validated with https://studio.asyncapi.com/

We need to properly configure those values, something that I will take care of in the next PR

* Fixed styles

* fix: Fixed broken tests

* fix: Added support to sqs-plugin to generate the minimum needed values

To pass the SQS Binding AsyncAPI validation, we need to provide some required fields. This commit adds the minimum values needed.

* fix: Added support to sns-plugin to generate the minimum needed values

To pass the SNS Binding AsyncAPI validation, we need to provide some required fields. This commit adds the minimum values needed.

* fix: Removed small batch of pending FIXMEs

* fix: Removed small batch of pending FIXMEs

* fix: Removed small batch of pending FIXMEs

* fix: Fixed the cloudstream-plugin

The cloudstream-plugin was not generating the operations section of the AsyncAPI spec. Now is fixed and validated.

Multiple FIXMEs were fixed and removed too

* fix: Removed unused methods

* fix: Fixed CloudStream operation action typo

* fix: Removed unneeded channelId field from ChannelObject

* fix: Fixed some code analysis complains

* fix: Fixed Operation messages bug

Whe configuring annotations on the class level, the generated Operations didn't have the proper message references.

This fixes the latest blocking FIXME

* fix: Schema Properties

The Schema Properties should support any kind of value, like booleans.

Making the property accept `Object` seems a more flexible approach.

* Feat/asyncapi 3: more fixes (#550)

* chore: typo

* fix: correct Listener=receive, Publisher=send operationAction

* feat(kafka): handle kafka message binding key

* chore: update example json

* feat(core): all operation include the action in the id

refactor: rename operationName to operationId

* feat(cloud-stream): align asyncapi.json structure

* feat(ui): show message when bindings are missing

* chore: resolve open FIXME

* chore: fix dependencies

* Support exclusiveMinimum and exclusiveMaximum (#560)

* feat(ui): add exclusiveMinimum and exclusiveMaximum values to the spec`s model
Feature request

Refs #378

* refactor(ui): reimplement range temple model

For further extension

Refs #378

* feat(ui): add support for exclusiveMinimum and exclusiveMaximum

Feature request

Refs #378

* refactor(ui): separate schema range as a component

For further extensions and maintenance

Refs #378

* test: add exclusiveMinimum to example Dto

To test changes visually

Refs #378

* chore: Split ChannelScanner and OperationScanner (#562)

---------

Co-authored-by: Nikita Marunko <aerfus@yandex.ru>
Co-authored-by: Carlos Tasada <ctasada@gmail.com>
@timonback
Copy link
Member

Hi @timonback , I've started working on tests for schema.component.ts. Checkout was from timonback:test/add-jest-testing-to-springwolf-ui

Hi @aerfus,
I am about to merge the jest PR. Due to squashing, you will need to rebase from the master branch. Sorry for the inconvenience.

aerfus added a commit to aerfus/springwolf-core that referenced this issue Jan 30, 2024
aerfus added a commit to aerfus/springwolf-core that referenced this issue Jan 30, 2024
aerfus added a commit to aerfus/springwolf-core that referenced this issue Jan 30, 2024
aerfus added a commit to aerfus/springwolf-core that referenced this issue Jan 30, 2024
aerfus added a commit to aerfus/springwolf-core that referenced this issue Jan 30, 2024
sam0r040 pushed a commit that referenced this issue Feb 2, 2024
* refactor(schema): correct margin and padding values

Warnings are present

Refs #378

* test(ui): cover schema-range component

0 coverage

Refs #378

* refactor(ui): simplify schema range rendering

Is difficult to maintain

Refs #378
timonback pushed a commit to timonback/springwolf-core that referenced this issue Feb 2, 2024
* refactor(schema): correct margin and padding values

Warnings are present

Refs springwolf#378

* test(ui): cover schema-range component

0 coverage

Refs springwolf#378

* refactor(ui): simplify schema range rendering

Is difficult to maintain

Refs springwolf#378
@timonback timonback reopened this Feb 4, 2024
@timonback
Copy link
Member

Closed accidentally.

We updated the mapping in the backend, currently supported fields can be found in https://github.com/springwolf/springwolf-core/blob/master/springwolf-core%2Fsrc%2Fmain%2Fjava%2Fio%2Fgithub%2Fstavshamir%2Fspringwolf%2Fschemas%2FSwaggerSchemaUtil.java which require Angular frontend changes only to be displayed - besides updating the kafka example (add the field to the @Schema annotation as done for i.e. maximum) to demonstrate it

Any help is welcome

aerfus added a commit to aerfus/springwolf-core that referenced this issue Mar 27, 2024
aerfus added a commit to aerfus/springwolf-core that referenced this issue Mar 27, 2024
aerfus added a commit to aerfus/springwolf-core that referenced this issue Apr 8, 2024
Material components are mentioned in the wrong section

Refs springwolf#378
sam0r040 pushed a commit that referenced this issue Apr 12, 2024
* chore: build website preview when asyncapi.json changes

* chore: build website preview when asyncapi.json changes

* chore: build website preview when asyncapi.json changes

* chore: build website preview when asyncapi.json changes

* refactor(schema): correct margin and padding values

Warnings are present

Refs #378

* test(ui): cover schema-range component

0 coverage

Refs #378

* refactor(ui): simplify schema range rendering

Is difficult to maintain

Refs #378

* test(ui): cover info component

Refs #378

* test(ui): cover all components

Are absent

Refs #378

* test(ui): fix invalid declaration error

Material components are mentioned in the wrong section

Refs #378

---------

Co-authored-by: Timon Back <timonback@users.noreply.github.com>
@aerfus
Copy link
Contributor

aerfus commented Apr 13, 2024

Hi @timonback ,
sorry my bad putting Resolves #378 in PRs.
Could you reopen this issue?

aerfus added a commit to aerfus/springwolf-core that referenced this issue Apr 13, 2024
@timonback timonback reopened this Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
3 participants