swagger-api / swagger-api/swagger-inflector

Custom ControllerFactory not working

Open
#116 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
172
Forks
85
Avg merge
58m
Merged PRs (30d)
2

Description

I am trying to use a custom ControllerFactory to instanciate the controllers used by Swagger Inflector, as suggested in the doc. I added this line in inflector.yaml :

controllerFactory: mycustompackage.CustomControllerFactory

When I try to access the controller based on this URI, I get the error below :

MessageBodyWriter not found for media type=null, type=class io.swagger.inflector.models.ApiError, genericType=class io.swagger.inflector.models.ApiError.

If I rename my custom controller so that it matches the signature "io.swagger.inflector.config.DefaultControllerFactory", and remove the line in the inflector.yaml file, then everything works fine.

Any ideas about how I can properly specify the class of my custom controller in the inflector.yaml file ?

Thanks in advance,
Alex

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the controllerFactory entry in inflector.yaml and compare how the custom class is specified with io.swagger.inflector.config.DefaultControllerFactory. Reproduce the reported URI request and trace the resulting ApiError and MessageBodyWriter error. Done means the configured custom factory is used and the request no longer produces this error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.