Skip to content

Commit

Permalink
make api v1 as default version (#1519)
Browse files Browse the repository at this point in the history
make api v1 as default version
issue: https://issues.redhat.com/browse/AAP-39012

Signed-off-by: Djebran Lezzoum <[email protected]>
  • Loading branch information
ldjebran authored Feb 4, 2025
1 parent 3e4232e commit ef52c47
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 59 deletions.
4 changes: 3 additions & 1 deletion ansible_ai_connect/main/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,12 @@ def is_ssl_enabled(value: str) -> bool:
"DEFAULT_RENDERER_CLASSES": ("rest_framework.renderers.JSONRenderer",),
"DEFAULT_VERSIONING_CLASS": "rest_framework.versioning.NamespaceVersioning",
"ALLOWED_VERSIONS": ("v0", "v1"),
"DEFAULT_VERSION": "v0",
"DEFAULT_VERSION": "v1",
"VERSION_PARAM": "version",
}

API_VERSION = "1.0.0"

# Current RHSSOAuthentication implementation is incompatible with tech preview terms partial
if not ANSIBLE_AI_ENABLE_TECH_PREVIEW:
REST_FRAMEWORK["DEFAULT_AUTHENTICATION_CLASSES"].insert(
Expand Down
4 changes: 2 additions & 2 deletions ansible_ai_connect/main/settings/development.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

from .base import * # NOQA
from .base import MIDDLEWARE, cast, os
from .base import API_VERSION, MIDDLEWARE, cast, os
from .types import t_wca_secret_backend_type

DEBUG = True
Expand All @@ -24,7 +24,7 @@
SPECTACULAR_SETTINGS = {
"TITLE": f"{ANSIBLE_AI_PROJECT_NAME}.", # noqa: F405
"DESCRIPTION": "Equip the automation developer at Lightspeed.",
"VERSION": "0.0.9",
"VERSION": API_VERSION,
"SERVE_INCLUDE_SCHEMA": False,
# OTHER SETTINGS
"TAGS": [
Expand Down
89 changes: 33 additions & 56 deletions tools/openapi-schema/ansible-ai-connect-service.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
openapi: 3.0.3
info:
title: Ansible AI Connect.
version: 0.0.9 (v0)
version: 1.0.0 (v1)
description: Equip the automation developer at Lightspeed.
paths:
/api/v0/ai/chat/:
/api/v1/ai/chat/:
post:
operationId: ai_chat_create
description: Send a message to the backend chatbot service and get a reply.
Expand Down Expand Up @@ -47,7 +47,7 @@ paths:
description: Internal server error
'503':
description: Service unavailable
/api/v0/ai/completions/:
/api/v1/ai/completions/:
post:
operationId: ai_completions_create
description: Returns inline code suggestions based on a given Ansible editor
Expand Down Expand Up @@ -111,7 +111,7 @@ paths:
description: Request was throttled
'503':
description: Service Unavailable
/api/v0/ai/contentmatches/:
/api/v1/ai/contentmatches/:
post:
operationId: ai_contentmatches_create
description: Returns content matches that were the highest likelihood sources
Expand Down Expand Up @@ -151,7 +151,7 @@ paths:
description: Request was throttled
'503':
description: Service Unavailable
/api/v0/ai/explanations/:
/api/v1/ai/explanations/:
post:
operationId: ai_explanations_create
description: Returns a text that explains a playbook.
Expand Down Expand Up @@ -192,7 +192,7 @@ paths:
description: Request was throttled
'503':
description: Service Unavailable
/api/v0/ai/feedback/:
/api/v1/ai/feedback/:
post:
operationId: ai_feedback_create
description: Feedback API for the AI service
Expand Down Expand Up @@ -234,48 +234,7 @@ paths:
description: Bad Request
'401':
description: Unauthorized
/api/v0/ai/generations/:
post:
operationId: ai_generations_create
description: Returns a playbook based on a text input.
summary: Inline code suggestions
tags:
- ai
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/GenerationPlaybookRequest'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/GenerationPlaybookRequest'
multipart/form-data:
schema:
$ref: '#/components/schemas/GenerationPlaybookRequest'
required: true
security:
- oauth2:
- read
- write
- cookieAuth: []
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/GenerationPlaybookResponse'
description: ''
'204':
description: Empty response
'400':
description: Bad Request
'401':
description: Unauthorized
'429':
description: Request was throttled
'503':
description: Service Unavailable
/api/v0/ai/generations/playbook:
/api/v1/ai/generations/playbook/:
post:
operationId: ai_generations_playbook_create
description: Returns a playbook based on a text input.
Expand Down Expand Up @@ -316,7 +275,7 @@ paths:
description: Request was throttled
'503':
description: Service Unavailable
/api/v0/ai/generations/role:
/api/v1/ai/generations/role/:
post:
operationId: ai_generations_role_create
description: Returns a role based on a text input.
Expand Down Expand Up @@ -349,7 +308,7 @@ paths:
description: ''
'401':
description: Unauthorized
/api/v0/me/:
/api/v1/me/:
get:
operationId: me_retrieve
tags:
Expand All @@ -363,7 +322,7 @@ paths:
schema:
$ref: '#/components/schemas/UserResponse'
description: ''
/api/v0/me/summary/:
/api/v1/me/summary/:
get:
operationId: me_summary_retrieve
tags:
Expand All @@ -377,7 +336,7 @@ paths:
schema:
$ref: '#/components/schemas/MarkdownUserResponse'
description: ''
/api/v0/telemetry/:
/api/v1/telemetry/:
get:
operationId: telemetry_settings_get
summary: Get the telemetry settings for an Organisation
Expand All @@ -401,6 +360,8 @@ paths:
description: Request was throttled
'500':
description: Internal service error
'501':
description: Not implemented
post:
operationId: telemetry_settings_set
summary: Set the Telemetry settings for an Organisation
Expand Down Expand Up @@ -442,7 +403,9 @@ paths:
description: Request was throttled
'500':
description: Internal service error
/api/v0/wca/apikey/:
'501':
description: Not implemented
/api/v1/wca/apikey/:
get:
operationId: wca_api_key_get
summary: Get WCA key for an Organisation
Expand All @@ -467,6 +430,8 @@ paths:
description: Request was throttled
'500':
description: Internal service error
'501':
description: Not implemented
post:
operationId: wca_api_key_set
summary: Set the WCA key for an Organisation
Expand Down Expand Up @@ -509,6 +474,8 @@ paths:
description: Request was throttled
'500':
description: Internal service error
'501':
description: Not implemented
delete:
operationId: wca_api_key_delete
summary: DELETE WCA key for an Organization
Expand All @@ -533,7 +500,9 @@ paths:
description: Request was throttled
'500':
description: Internal service error
/api/v0/wca/apikey/test/:
'501':
description: Not implemented
/api/v1/wca/apikey/test/:
get:
operationId: wca_api_key_validator_get
summary: Validate WCA key for an Organisation
Expand All @@ -556,7 +525,9 @@ paths:
description: Request was throttled
'500':
description: Internal service error
/api/v0/wca/modelid/:
'501':
description: Not implemented
/api/v1/wca/modelid/:
get:
operationId: wca_model_id_get
summary: Get WCA Model Id for an Organisation
Expand All @@ -580,6 +551,8 @@ paths:
description: Request was throttled
'500':
description: Internal service error
'501':
description: Not implemented
post:
operationId: wca_model_id_set
summary: Set the Model Id to be used for an Organisation
Expand Down Expand Up @@ -621,7 +594,9 @@ paths:
description: Request was throttled
'500':
description: Internal service error
/api/v0/wca/modelid/test/:
'501':
description: Not implemented
/api/v1/wca/modelid/test/:
get:
operationId: wca_model_id_validator_get
summary: Validate WCA Model Id for an Organisation
Expand All @@ -644,6 +619,8 @@ paths:
description: Request was throttled
'500':
description: Internal service error
'501':
description: Not implemented
/check/:
get:
operationId: check_retrieve
Expand Down

0 comments on commit ef52c47

Please sign in to comment.