Git Product home page Git Product logo

Comments (10)

LandryNorris avatar LandryNorris commented on August 25, 2024 1

The README looks good (in the sense that I think I could find the solution from the README alone now). I can anecdotally say that the oauth authentication method appears to be recognized in addition to jwt, but the resulting swagger page doesn't let me put in my JWT I get from OAuth.

from kompendium.

LandryNorris avatar LandryNorris commented on August 25, 2024

Adding Kompendium.pathCalculator = AuthPathCalculator() to the code appears to fix this issue. Is there a way to make this the default?

from kompendium.

unredundant avatar unredundant commented on August 25, 2024

Yes this is the intended approach, but you make a really great point that this is not particularly intuitive.

The problem here lies in the modularity... the core package really has no concept of the auth package.

I wonder if we can adjust the way the path calculator is instantiated to allow for default overrides. Because you're right, when someone does add the auth package, they are definitely going to want to include this path, and making the user do the leg work to add it is not very seamless.

Will think more on this 🙂 But if you want to dig in through the code and see if you can put together a way to tackle this I'd love to see it!

from kompendium.

unredundant avatar unredundant commented on August 25, 2024

At the very least, I need to add better documentation around this. Really sorry that there is nothing in the readme about this!

from kompendium.

unredundant avatar unredundant commented on August 25, 2024

It is interesting that you ran into this bug.. the developer that created the auth module seems to have anticipated this as the KompendiumAuth object has an init block

init {
  Kompendium.pathCalculator = AuthPathCalculator()
}

Regardless, my initial design is bad, because if we ever have any extra modules, it will not work to simply override with another. Definitely need to rethink this

from kompendium.

LandryNorris avatar LandryNorris commented on August 25, 2024

Would it make sense to use some sort of interface list to hold the extended selectors? The current design appears to only support one extension without writing a when that calls handleCustomSelectors for each module you want to add. The CorePathCalculator's handleCustomSelectors could iterate over a hypothetical customSelectors list (or potentially use .filter{ some method in the interface that returns true if you handle the selector}.first() or something similar if you only want one module to handle it). This could also allow for multiple modules to add info to a route.

from kompendium.

unredundant avatar unredundant commented on August 25, 2024

We are on a similar train of thought :) I am working on a potential solution, should have a PR out soon that I'll link here

from kompendium.

unredundant avatar unredundant commented on August 25, 2024

@LandryNorris put out this PR ^^^ in particular check out the README documentation, want to make sure it is clear :)

I still think this implementation is a bit convoluted (particularly the handler method), but I can't think of a way to simplify it at the moment. Ideally, for 99.9% of users it will just work, and they won't have to worry about it, and then for the rare case where someone needs to add a path handler, hopefully the documentation updates will make that easier to understand

from kompendium.

unredundant avatar unredundant commented on August 25, 2024

Ooh interesting! That sounds like a different bug, could you open up a new issue for that?

from kompendium.

unredundant avatar unredundant commented on August 25, 2024

Hmmm @LandryNorris I just ran a couple things in the playground, auth seems to work fine in swagger as far as I can tell.. did you make sure to set securitySchemes = setOf("yourAuthScheme") in the MethodInfo?

from kompendium.

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.