springwolf-core icon indicating copy to clipboard operation
springwolf-core copied to clipboard

Schemas converted to String type, when default content type changed to application/yaml

Open MrOli1412 opened this issue 1 year ago • 1 comments

Describe the bug When I changed default-content-type to application/yaml generated file and springwolf-ui received in Schemas section all POJO's as String object.

Dependencies and versions used tested on latest master version(1.3.0-SNAPSHOT) and 1.2.0 of springwolf-amqp springwolf-ui

Code example Proper working springwolf.docket.default-content-type=application/json (default) proper_working

Issue springwolf.docket.default-content-type=application/yaml I was working on yours AMQP example (https://github.com/springwolf/springwolf-core/tree/master/springwolf-examples/springwolf-amqp-example), and I changed default-content-type in docker-compose.yaml

version: '3'
services:
  app:
    image: stavshamir/springwolf-amqp-example:${SPRINGWOLF_VERSION}
    environment:
      - SPRINGWOLF_DOCKET_DEFAULT-CONTENT-TYPE=application/yaml
    links:
      - amqp
    ports:
      - "8080:8080"
    depends_on:
      - amqp

  amqp:
    image: rabbitmq:3.8-management-alpine
    ports:
      # AMQP protocol port
      - '5672:5672'
      # HTTP management UI
      - '15672:15672'

Result: issue

MrOli1412 avatar May 14 '24 10:05 MrOli1412

Welcome to Springwolf. Thanks a lot for reporting your first issue. Please check out our contributors guide and feel free to join us on discord.

github-actions[bot] avatar May 14 '24 10:05 github-actions[bot]

Hi @MrOli1412 This is a workaround so that async api studio can render the asyncapi.yaml file, see https://github.com/springwolf/springwolf-core/blob/master/springwolf-core%2Fsrc%2Fmain%2Fjava%2Fio%2Fgithub%2Fspringwolf%2Fcore%2Fasyncapi%2Fcomponents%2Fexamples%2Fwalkers%2Fyaml%2FExampleYamlValueGenerator.java#L42

Feel free to upvote/comment the linked issue https://github.com/asyncapi/spec/issues/1038

timonback avatar May 16 '24 17:05 timonback

We suggested the code change https://github.com/stoplightio/spectral/pull/2625, which we believe will address the underlying issue.

When merged & released, we will remove the workaround from Springwolf.

timonback avatar May 24 '24 16:05 timonback

The change is staged for release and will be part of the next release.

If you want to try and verify it in your application today, use the latest 1.X.0-SNAPSHOT build as described in our README.md > Testing SNAPSHOT version

Thank you for the report/contribution!

github-actions[bot] avatar Jun 29 '24 11:06 github-actions[bot]

Hi @MrOli1412, as a workaround, we introduced with the latest release a configuration property springwolf.studio-compatibility, which you can disable to avoid "fixing" the schema type for yaml content-type.

timonback avatar Jun 29 '24 11:06 timonback

The change is available in the latest release. 🎉

Thank you for the report/contribution and making Springwolf better!

github-actions[bot] avatar Jun 29 '24 11:06 github-actions[bot]