thim81 / asyncapi-format

Format an AsyncAPI document by ordering, formatting and filtering fields.
MIT License
6 stars 1 forks source link

Sort locally-stored referenced files as well? #13

Open philCryoport opened 1 year ago

philCryoport commented 1 year ago

Hi there,

For readability and re-usability, we have extracted the schemas out of the primary AsyncAPI YAML file into a file ./components/schemas.yaml -- and then have lots of $ref entries in the main AsyncAPI YAML file, i.e.:

...
schemas:
  foo_enum:
     $ref: './components/schemas.yaml#/components/schemas/foo_enum'

How do I use the application to sort that child / referred-to file?

thim81 commented 1 year ago

hi @philCryoport

At the moment, it does not sort $ref elements. Although that is a very valuable feature, so I'll put it on the list of future features.

There is one limitation, last time I did an investigation around this feature, I found that sorting $ref files means that all the $ref need to be dereferenced, resulting in a single output file.

My guess is that you want to be able to sort the async file with $ref and have the $ref files themselves updated and not one dereferenced async.yaml file?

philCryoport commented 1 year ago

My guess is that you want to be able to sort the async file with $ref and have the $ref files themselves updated and not one dereferenced async.yaml file?

Hi @thim81 correct!

My hope was that the end result of sorting would be: