-
Notifications
You must be signed in to change notification settings - Fork 138
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
Graphiti schema does not include endpoints with subdomain constraint #412
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm trying to configure the Vandal UI for a Rails application, Vandal does not display any available endpoints.
The
schema.json
that Vandal fetched does not contain anyendpoints
.I'm using a
subdomain
constraint on the route of my endpoints.I dig a little in the source code, and realise that the
Graphiti::Schema.generate
uses theGraphiti.config.context_for_endpoint
.graphiti/lib/graphiti/schema.rb
Line 59 in aecf564
graphiti/lib/graphiti/schema.rb
Lines 84 to 86 in aecf564
Which is configured by graphiti-rails in lib/graphiti/rails/railtie.rb#L120-L139.
The problem is that in order for recognize_path to return the route for a subdomain constraint, the
path
should include thehost
(ex:http://api.example.com/v1
) instead of the path (ex:/v1
).This can be easily fixed by changing the
Graphiti.config.context_for_endpoint
in a Rails initializer (ex:config/initializers/graphiti.rb
).After this change, the schema contains the expected endpoints.
I'm wondering if some changes should be made (gem graphiti, gem graphiti-rails) so the this is handled by default. I'm opening an issue to document the issue, but also to discuss potential changes to improve Graphiti. 🙂
I know that a Resource has a
base_url
(through the moduleGraphiti::Links
).graphiti/lib/graphiti/resource/links.rb
Line 19 in 19c75b5
Maybe the resource
base_url
should prefix the endpointfull_path
when callingGraphiti.config.context_for_endpoint
fromGraphiti::Schema.generate_endpoints
. 🤔The text was updated successfully, but these errors were encountered: