Skip to content

some routes randomly ignored #3

@sbiefeni

Description

@sbiefeni

Thanks for this great product, our team has been using it to generate swagger for our project.

We do have a problem though, some random routes just absolutely refuse to get output into the generated .json file.. for no apparent reason that we can find. it's maybe 3% of the routes. It's not related to the markup, the http method, or anything else we can find (we tried many variations to make them work, renaming, re-ordering, markup on top rather than at the end, etc.). In our project, it's about 7 routes out of hundreds.
No errors are shown when generating:
Swagger-autogen: Success ✔

I'm wondering if there are any known issues with parsing the routes files?

As a quick example, in the below 4 routes (in the same routes file), only
the first one does not output. The controller methods are all built and marked up almost identically. We just can't find any reason it never gets rendered.

api.put("/v1/profiles/:profileId/preferences", updateProfilePreferences); << this is never rendered
api.get("/v1/profiles/:profileId/households", getHouseholdsByProfileId);
api.get("/v1/profiles/:profileId/preferences", getProfilePreferences);
api.post("/v1/profiles/:profileId/preferences", createProfilePreferences);

Autogen does however output the default:
"put": {
"description": "",
"parameters": [
{
"name": "profileId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"default": {
"description": ""
}
}
}

An example of the markup style we are using:
export const createProfilePreferences = async (
req: Request,
res: Response,
next: NextFunction
): Promise => {
baseProxy.apiName = "Create Profile Preference";
baseProxy.baseUrl = config.smartHome.profiles.baseUrl;
const response = await baseProxy.basePost(req, res, next, createProfilePreferencesEndpoint);
res.json(response);
/*
#swagger.tags = ['Profile Management-Profile']
#swagger.summary = 'Create a profile Preference'
#swagger.parameters['x-unified-household-id'] = {
in: 'header',
description: 'Household Id',
required: true,
type: 'string',
example: '01HF806Q5EFZQ0354GQGKFD2AX'
}
#swagger.description = 'Create a Profile Preference'
#swagger.requestBody = {
schema: { $ref: "#/components/schemas/profilePreferences" }
}
#swagger.responses[200] = {
description: 'Create a Profile',
schema: {
$ref: "#/components/schemas/profilePreferences"
}
}
*/
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions