GithubHelp home page GithubHelp logo

feat: show event examples about eventcatalog HOT 8 OPEN

boyney123 avatar boyney123 commented on May 18, 2024 13
feat: show event examples

from eventcatalog.

Comments (8)

boyney123 avatar boyney123 commented on May 18, 2024 2

hi @boyney123

Adding /event-examples directory would be a very logical solution.

The tricky part will be the rendering part and I guess mostly the UI aspect, like where to put the example in the event details screen.

image

Where to put this?

Maybe an MDX Component that people can choose where to put it.

I might also explore some kind of component that allows people to put things side by side, in your example it could be

<Splitter>
    <SchemaViewer/>
    <EventExample example="example1" />
</Splitter>

This could render the things side by side and allow you to choose which event example to render

from eventcatalog.

thim81 avatar thim81 commented on May 18, 2024 1

@boyney123 The <splitter> would be really interesting, since you typically want to have the example and schema properties in 1 view to be able to understand what is shown.

from eventcatalog.

dytyniuk avatar dytyniuk commented on May 18, 2024

Hi @thim81

Can the Code Examples feature help with your case?

from eventcatalog.

boyney123 avatar boyney123 commented on May 18, 2024

Hey @thim81 ,

Thanks for the idea, just looking at everything now, I was certain this was supported already but I can't find anything 😅, yeah great idea. I guess we could add /event-examples directory or something inside the events and let peolpe just add any filetype they want and have the UI render it?

Following from @dytyniuk yeah I guess Code Examples could work there too, but I guess if we had an explicit place we could store this stuff might be better?

Any ideas on where we could store examples of the events? My thoughts is add a new directory and if events are in there maybe the UI can render them, or user opt-in into new component

from eventcatalog.

thim81 avatar thim81 commented on May 18, 2024

hi @boyney123

Adding /event-examples directory would be a very logical solution.

The tricky part will be the rendering part and I guess mostly the UI aspect, like where to put the example in the event details screen.

image

Where to put this?

from eventcatalog.

dytyniuk avatar dytyniuk commented on May 18, 2024

hi @boyney123

I thought about your suggestion to add the event-examples directory a bit. And here is what I have come through:

  1. At first I had a thought, it would be enough to have a single example of the event. Just like with its' schema -- if you have some other example, that could be lookling as a new version of the event. So, an example based on a single file looked legit.
  2. Although, I have realised, that the event can contain optional properties, and one may need to show more that one example.
  3. You have already implemeted the examples directory to keep code samples. How about adding an extra directory there? Something like this:
└─ events
   ├─ index.md
   ├─ schema.json
   └─ examples
      ├─ code-sample.js
      └─ event
         ├─ example-a.json
         └─ example-b.json

@thim81 does look like something helping with your issue?

from eventcatalog.

boyney123 avatar boyney123 commented on May 18, 2024

hi @boyney123

I thought about your suggestion to add the event-examples directory a bit. And here is what I have come through:

  1. At first I had a thought, it would be enough to have a single example of the event. Just like with its' schema -- if you have some other example, that could be lookling as a new version of the event. So, an example based on a single file looked legit.
  2. Although, I have realised, that the event can contain optional properties, and one may need to show more that one example.
  3. You have already implemeted the examples directory to keep code samples. How about adding an extra directory there? Something like this:
└─ events
   ├─ index.md
   ├─ schema.json
   └─ examples
      ├─ code-sample.js
      └─ event
         ├─ example-a.json
         └─ example-b.json

@thim81 does look like something helping with your issue?

Yeah I like this solution, keeping the examples code in the one place, I will implement it and see how it feels and make sure it does not impact the other components. Thanks!

from eventcatalog.

thim81 avatar thim81 commented on May 18, 2024

Just thinking of this some more, once this in is place, it would be interesting to extend the asyncapi generator to dump the "examples" in the appropriate files.

from eventcatalog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.