Skip to content

Commit

Permalink
fixing #5 validator.swagger.io errors
Browse files Browse the repository at this point in the history
for errors from validator like:
  "attribute paths.'/v1/author'(get).parameters.[language].default is unexpected"
To solve this error the default value for the language parameter is defined
within the schema object inside the decorator.
  • Loading branch information
muhme committed Oct 31, 2023
1 parent caec97c commit 5ac098d
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 14 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ Fetched 570 categories

## History

- October 31, 2023 v1.1.2 fixing validator.swagger.io errors ([Issue #4](../../issues/4))
- October 30, 2023 v1.1.1 [/v1/authors](https://api.zitat-service.de/v1/authors) list is now sorted by lastname first and firstname second ([Issue #4](../../issues/4))
- October 3, 2023 v1.1.0 with additional endpoint [/v1/quote_html](https://api.zitat-service.de/v1/quote_html)
- September 20, 2023 v1.0.0 launched with six JSON endpoints
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "api.zitat-service.de",
"version": "1.1.1",
"version": "1.1.2",
"description": "The API provides functionality to retrieve quotes, along with related entries such as their respective authors and associated categories, from the website <a href=\"https://www.zitat-service.de\">zitat.service.de</a>. The content delivered by the API is available in five languages: English 🇺🇸, Español 🇪🇸, 日本語 🇯🇵, Українська 🇺🇦 and Deutsch 🇩🇪. While the content is multilingual, the API itself is provided only in English. You can find the open-source software project hosted on GitHub at <a href=\"https://github.com/muhme/quote_api\">github.com/muhme/quote_api</a>.",
"keywords": [
"loopback-application",
Expand Down
25 changes: 20 additions & 5 deletions src/controllers/authors.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,17 +208,26 @@ export class AuthorsController {
async getAuthors(
@param.query.string('language', {
description: 'The `language` for the author entries. See `/v1/languages` for available language codes.',
default: 'en'
schema: {
type: 'string',
default: 'en'
}
}) language = 'en',

@param.query.integer('page', {
description: 'The response is made page by page, the parameter `page` controls the page number of the result. Starting with page 1.',
default: 1
schema: {
type: 'integer',
default: 1
}
}) page = 1,

@param.query.integer('size', {
description: 'The response is made page by page, the parameter `size` controls how many entries are returned on a page.',
default: 100
schema: {
type: 'integer',
default: 100
}
}) size = 100,

@param.query.string('lastname', {
Expand Down Expand Up @@ -296,12 +305,18 @@ export class AuthorsController {
async getAuthor(
@param.query.string('language', {
description: 'The `language` for the author entry. See `/v1/languages` for all available languages.',
default: 'en'
schema: {
type: 'string',
default: 'en'
}
}) language = 'en',

@param.query.integer('authorId', {
description: 'Authors ID. For a list of all author entries with their IDs see `/v1/authors`.',
default: 1
schema: {
type: 'integer',
default: 1
}
}) authorId = 1
): Promise<AuthorReturned | null> {
const filter: AuthorFilter = {
Expand Down
15 changes: 12 additions & 3 deletions src/controllers/categories.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,26 @@ export class CategoriesController {
async getCategories(
@param.query.string('language', {
description: 'The language for the category entries. See `/v1/languages` for available languages.',
default: 'en'
schema: {
type: 'string',
default: 'en'
}
}) language = 'en',

@param.query.integer('page', {
description: 'The response is made page by page, the parameter `page` controls the page number of the result. Starting with page 1.',
default: 1
schema: {
type: 'integer',
default: 1
}
}) page = 1,

@param.query.integer('size', {
description: 'The response is made page by page, the parameter `size` controls how many entries are returned on a page.',
default: 100
schema: {
type: 'integer',
default: 100
}
}) size = 100,

@param.query.string('starting', {
Expand Down
5 changes: 4 additions & 1 deletion src/controllers/quotation.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,10 @@ export class QuotationController {
}) style?: string,
@param.query.boolean('contentOnly', {
description: DESCRIPTIONS['contentOnly'],
default: false
schema: {
type: 'boolean',
default: false
}
}) contentOnly?: boolean,
@param.query.string('target', {
description: DESCRIPTIONS['target']
Expand Down
10 changes: 8 additions & 2 deletions src/controllers/users.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,18 @@ export class UsersController {
@param.query.integer('page', {
description: "The response is made page by page, the optional parameter \
`page` controls the page number of the result. Starting with page 1.",
default: 1
schema: {
type: 'integer',
default: 1
}
}) page = 1,
@param.query.integer('size', {
description: "The response is made page by page, the optional parameter \
`size` controls how many entries are returned on a page.",
default: 100
schema: {
type: 'integer',
default: 100
}
}) size = 100,
@param.query.string('starting', {
description: `The beginning of the login name to limit the list for \
Expand Down

0 comments on commit 5ac098d

Please sign in to comment.