Skip to content
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

Fixes for OpenAPI Generation: Exception with oneOf/anyOf/allOf; Correct Schema with -NoProperties; Accurate Output with -NoDefaultResponses; Include Min/Max Properties; Prevent Request Body on GET Operations #1369

Merged
merged 7 commits into from
Aug 20, 2024
Merged
2 changes: 1 addition & 1 deletion src/Locales/ar/Pode.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -286,5 +286,5 @@
openApiDefinitionAlreadyExistsExceptionMessage = 'تعريف OpenAPI باسم {0} موجود بالفعل.'
renamePodeOADefinitionTagExceptionMessage = "لا يمكن استخدام Rename-PodeOADefinitionTag داخل Select-PodeOADefinition 'ScriptBlock'."
definitionTagChangeNotAllowedExceptionMessage = 'لا يمكن تغيير علامة التعريف لمسار.'
getRequestBodyNotAllowedExceptionMessage = 'لا يمكن أن تحتوي عمليات GET على محتوى الطلب.'
getRequestBodyNotAllowedExceptionMessage = 'لا يمكن أن تحتوي عمليات {0} على محتوى الطلب.'
}
2 changes: 1 addition & 1 deletion src/Locales/de/Pode.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -286,5 +286,5 @@
openApiDefinitionAlreadyExistsExceptionMessage = 'Die OpenAPI-Definition mit dem Namen {0} existiert bereits.'
renamePodeOADefinitionTagExceptionMessage = "Rename-PodeOADefinitionTag kann nicht innerhalb eines 'ScriptBlock' von Select-PodeOADefinition verwendet werden."
definitionTagChangeNotAllowedExceptionMessage = 'Definitionstag für eine Route kann nicht geändert werden.'
getRequestBodyNotAllowedExceptionMessage = 'GET-Operationen können keinen Anforderungstext haben.'
getRequestBodyNotAllowedExceptionMessage = '{0}-Operationen können keinen Anforderungstext haben.'
}
2 changes: 1 addition & 1 deletion src/Locales/en-us/Pode.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -286,5 +286,5 @@
openApiDefinitionAlreadyExistsExceptionMessage = 'OpenAPI definition named {0} already exists.'
renamePodeOADefinitionTagExceptionMessage = "Rename-PodeOADefinitionTag cannot be used inside a Select-PodeOADefinition 'ScriptBlock'."
definitionTagChangeNotAllowedExceptionMessage = 'Definition Tag for a Route cannot be changed.'
getRequestBodyNotAllowedExceptionMessage = 'GET operations cannot have a Request Body.'
getRequestBodyNotAllowedExceptionMessage = '{0} operations cannot have a Request Body.'
}
2 changes: 1 addition & 1 deletion src/Locales/en/Pode.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,6 @@
openApiDefinitionAlreadyExistsExceptionMessage = 'OpenAPI definition named {0} already exists.'
renamePodeOADefinitionTagExceptionMessage = "Rename-PodeOADefinitionTag cannot be used inside a Select-PodeOADefinition 'ScriptBlock'."
definitionTagChangeNotAllowedExceptionMessage = 'Definition Tag for a Route cannot be changed.'
getRequestBodyNotAllowedExceptionMessage = 'GET operations cannot have a Request Body.'
getRequestBodyNotAllowedExceptionMessage = '{0} operations cannot have a Request Body.'
}

2 changes: 1 addition & 1 deletion src/Locales/es/Pode.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -286,5 +286,5 @@
openApiDefinitionAlreadyExistsExceptionMessage = 'La definición de OpenAPI con el nombre {0} ya existe.'
renamePodeOADefinitionTagExceptionMessage = "Rename-PodeOADefinitionTag no se puede usar dentro de un 'ScriptBlock' de Select-PodeOADefinition."
definitionTagChangeNotAllowedExceptionMessage = 'La etiqueta de definición para una Route no se puede cambiar.'
getRequestBodyNotAllowedExceptionMessage = 'Las operaciones GET no pueden tener un cuerpo de solicitud.'
getRequestBodyNotAllowedExceptionMessage = 'Las operaciones {0} no pueden tener un cuerpo de solicitud.'
}
2 changes: 1 addition & 1 deletion src/Locales/fr/Pode.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,6 @@
openApiDefinitionAlreadyExistsExceptionMessage = 'La définition OpenAPI nommée {0} existe déjà.'
renamePodeOADefinitionTagExceptionMessage = "Rename-PodeOADefinitionTag ne peut pas être utilisé à l'intérieur d'un 'ScriptBlock' de Select-PodeOADefinition."
definitionTagChangeNotAllowedExceptionMessage = 'Le tag de définition pour une Route ne peut pas être modifié.'
getRequestBodyNotAllowedExceptionMessage = 'Les opérations GET ne peuvent pas avoir de corps de requête.'
getRequestBodyNotAllowedExceptionMessage = 'Les opérations {0} ne peuvent pas avoir de corps de requête.'
}

2 changes: 1 addition & 1 deletion src/Locales/it/Pode.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -286,5 +286,5 @@
openApiDefinitionAlreadyExistsExceptionMessage = 'La definizione OpenAPI denominata {0} esiste già.'
renamePodeOADefinitionTagExceptionMessage = "Rename-PodeOADefinitionTag non può essere utilizzato all'interno di un 'ScriptBlock' di Select-PodeOADefinition."
definitionTagChangeNotAllowedExceptionMessage = 'Il tag di definizione per una Route non può essere cambiato.'
getRequestBodyNotAllowedExceptionMessage = 'Le operazioni GET non possono avere un corpo della richiesta.'
getRequestBodyNotAllowedExceptionMessage = 'Le operazioni {0} non possono avere un corpo della richiesta.'
}
2 changes: 1 addition & 1 deletion src/Locales/ja/Pode.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,6 @@
openApiDefinitionAlreadyExistsExceptionMessage = '名前が {0} の OpenAPI 定義は既に存在します。'
renamePodeOADefinitionTagExceptionMessage = "Rename-PodeOADefinitionTag は Select-PodeOADefinition 'ScriptBlock' 内で使用できません。"
definitionTagChangeNotAllowedExceptionMessage = 'Routeの定義タグは変更できません。'
getRequestBodyNotAllowedExceptionMessage = 'GET操作にはリクエストボディを含めることはできません。'
getRequestBodyNotAllowedExceptionMessage = '{0}操作にはリクエストボディを含めることはできません。'
}

2 changes: 1 addition & 1 deletion src/Locales/ko/Pode.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -286,5 +286,5 @@
openApiDefinitionAlreadyExistsExceptionMessage = '이름이 {0}인 OpenAPI 정의가 이미 존재합니다.'
renamePodeOADefinitionTagExceptionMessage = "Rename-PodeOADefinitionTag은 Select-PodeOADefinition 'ScriptBlock' 내에서 사용할 수 없습니다."
definitionTagChangeNotAllowedExceptionMessage = 'Route에 대한 정의 태그는 변경할 수 없습니다.'
getRequestBodyNotAllowedExceptionMessage = 'GET 작업에는 요청 본문이 있을 수 없습니다.'
getRequestBodyNotAllowedExceptionMessage = '{0} 작업에는 요청 본문이 있을 수 없습니다.'
}
2 changes: 1 addition & 1 deletion src/Locales/nl/Pode.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,6 @@
openApiDefinitionAlreadyExistsExceptionMessage = 'OpenAPI-definitie met de naam {0} bestaat al.'
renamePodeOADefinitionTagExceptionMessage = "Rename-PodeOADefinitionTag kan niet worden gebruikt binnen een Select-PodeOADefinition 'ScriptBlock'."
definitionTagChangeNotAllowedExceptionMessage = 'Definitietag voor een route kan niet worden gewijzigd.'
getRequestBodyNotAllowedExceptionMessage = 'GET-operaties kunnen geen Request Body hebben.'
getRequestBodyNotAllowedExceptionMessage = '{0}-operaties kunnen geen Request Body hebben.'
}

2 changes: 1 addition & 1 deletion src/Locales/pl/Pode.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,6 @@
openApiDefinitionAlreadyExistsExceptionMessage = 'Definicja OpenAPI o nazwie {0} już istnieje.'
renamePodeOADefinitionTagExceptionMessage = "Rename-PodeOADefinitionTag nie może być używany wewnątrz 'ScriptBlock' Select-PodeOADefinition."
definitionTagChangeNotAllowedExceptionMessage = 'Tag definicji dla Route nie może zostać zmieniony.'
getRequestBodyNotAllowedExceptionMessage = 'Operacje GET nie mogą mieć treści żądania.'
getRequestBodyNotAllowedExceptionMessage = 'Operacje {0} nie mogą mieć treści żądania.'
}

2 changes: 1 addition & 1 deletion src/Locales/pt/Pode.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -286,5 +286,5 @@
openApiDefinitionAlreadyExistsExceptionMessage = 'A definição OpenAPI com o nome {0} já existe.'
renamePodeOADefinitionTagExceptionMessage = "Rename-PodeOADefinitionTag não pode ser usado dentro de um 'ScriptBlock' Select-PodeOADefinition."
definitionTagChangeNotAllowedExceptionMessage = 'A Tag de definição para uma Route não pode ser alterada.'
getRequestBodyNotAllowedExceptionMessage = 'As operações GET não podem ter um corpo de solicitação.'
getRequestBodyNotAllowedExceptionMessage = 'As operações {0} não podem ter um corpo de solicitação.'
}
2 changes: 1 addition & 1 deletion src/Locales/zh/Pode.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -286,5 +286,5 @@
openApiDefinitionAlreadyExistsExceptionMessage = '名为 {0} 的 OpenAPI 定义已存在。'
renamePodeOADefinitionTagExceptionMessage = "Rename-PodeOADefinitionTag 不能在 Select-PodeOADefinition 'ScriptBlock' 内使用。"
definitionTagChangeNotAllowedExceptionMessage = 'Route的定义标签无法更改。'
getRequestBodyNotAllowedExceptionMessage = 'GET 操作不能包含请求体。'
getRequestBodyNotAllowedExceptionMessage = '{0} 操作不能包含请求体。'
}
7 changes: 4 additions & 3 deletions src/Public/OpenApi.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -779,9 +779,10 @@ function Set-PodeOARequest {
}

if ($null -ne $RequestBody) {
if ($r.Method -eq 'Get') {
# GET operations cannot have a Request Body.
throw $PodeLocale.getRequestBodyNotAllowedExceptionMessage
# Only 'POST', 'PUT', 'PATCH' can have a request body
if (('POST', 'PUT', 'PATCH') -icontains $r.Method ) {
# {0} operations cannot have a Request Body.
throw ($PodeLocale.getRequestBodyNotAllowedExceptionMessage -f $r.Method)
mdaneri marked this conversation as resolved.
Show resolved Hide resolved
}
$r.OpenApi.RequestBody = $RequestBody
}
Expand Down