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

SigSpec UI #35

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from
Draft

Conversation

TomSmith27
Copy link
Contributor

@TomSmith27 TomSmith27 commented May 21, 2020

The Start of a UI for SigSpec similar to swagger UI

Closes #7

Will fetch the SigSpec json from 'sigspsec/spec.json' and render a UI based on the data.

Features

  • Listen to callbacks
  • Send Operations
  • View the Definitions

Hubs

image

Each hub will try and connect on page load and display an indicator to show whether this was successful

Callbacks

image

This is an example of a callback, it allows you to start and stop listening to a callback, and while listening any incoming messages will appear in the black box with the timestamp and the parameters of the message.

Operations

image

Operations work very much like post requests in SwaggerUI and will allow to fill in the method parameters this can be either primitive types or objects

Definitions

image

This works the same as SwaggerUI

Open tasks

  • Easy way to publish/update ui output into SigSpec.AspNetCore/SigSpecUI (also done in CI build before nuget build)
  • Somehow we need to patch the index.html and inject options from the ui middleware (eg spec routes from registration documents), settings with Route and {documentName} placeholder (similar to json middleware)
  • Clone Template document in generator before populating it

@TomSmith27
Copy link
Contributor Author

@RicoSuter Would you be able to take a quick look at this, I have started to work on the SigSpecUI, just wanted to make sure i am heading down the correct track with this?

If you read the comments above you can see a list of Features that are currently implemented.

If you run the UI project you will also need to run the HelloSignalR example as that's where it gets the spec from, in time this will work as Middleware.

@RicoSuter
Copy link
Owner

RicoSuter commented May 21, 2020

Lgtm

I see the following tasks:

  • Easy way to publish ui output into SigSpec.AspNetCore/SigSpecUI (also done in CI build before nuget build)
  • Somehow we need to patch the index.html and inject options from the ui middleware (eg spec urls)
  • In AspNetCore: Add AddSigSpecDocument (multiple allowed like in nswag) and provide these urls via options (ui should support multiple urls like swagger ui)

What do you think?

Very nice btw, i personally dont use SignalR much, so wont be able to contribute much.

TomSmith and others added 5 commits May 22, 2020 15:48
…s' into feature/sigspec-ui

# Conflicts:
#	src/SigSpec.AspNetCore/Extensions/SigSpecApplicationBuilderExtensions.cs
#	src/SigSpec.AspNetCore/SigSpec.AspNetCore.csproj
#	src/SigSpec.AspNetCore/SigSpecSettings.cs
# Conflicts:
#	src/SigSpec.AspNetCore/Extensions/SigSpecApplicationBuilderExtensions.cs
#	src/SigSpec.AspNetCore/SigSpecSettings.cs
#	src/SigSpec.AspNetCore/SigSpecUi/index.html
#	src/SigSpec.AspNetCore/SigSpecUiSettings.cs
@RicoSuter
Copy link
Owner

Btw, i’m not saying nswag is the way we should do it - there are many things which i would do differently internally but i dont have the tike to change it.. at least we should make the api as similar as possible.. please tell me if something doesnt make sense or could be simplified..

I’ve added some tasks to the issue, but we can also move them to separate gh issues..

@TomSmith27
Copy link
Contributor Author

Cool thanks for taking a look i am hoping to get some more time to work on adding the features you mentioned such as injecting the settings into the html, and adding support for a JWT token. as the app i am working on requires one for the SignalR.

I haven't really looked at the NSwag code much so dont know if there is anything we need to do differently for this project,

.gitignore Outdated Show resolved Hide resolved
src/SigSpec.UI/package.json Outdated Show resolved Hide resolved
namespace SigSpec.AspNetCore.Middlewares
using Microsoft.AspNetCore.Http;

namespace SigSpec.AspNetCore.Middlewares
{
public class SigSpecSettings
{
/// <summary>Gets or sets the path to serve the SigSpec document (default: '/sigspec/{documentName}/sigspec.json').</summary>
public string Path { get; set; } = "/sigspec/{documentName}/sigspec.json";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to Route? What is the default in asp?

@RicoSuter
Copy link
Owner

Is there any update on this?

@TomSmith27
Copy link
Contributor Author

Hey sorry, I have been busy with work, i will try resolve the code review comments today and add the authentication, then maybe it could be ready for an alpha release?

@seriouz
Copy link

seriouz commented Aug 16, 2020

@RicoSuter @TomSmith27 any news on this?

@TomSmith27
Copy link
Contributor Author

I am still planning to work on it, all that needs implementing now is a way to provide a token like normal swagger so will try and do that this week

@RicoSuter
Copy link
Owner

a way to provide a token

What do you mean with that? Authentication?

@dovjar dovjar mentioned this pull request Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implementation frontend part similar to Swagger UI
3 participants