You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by ar...@apache.org on 2020/09/04 19:09:40 UTC
[incubator-nlpcraft] 01/02: WIP.
This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch NLPCRAFT-41
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
commit a488e43d5378df2eb2c7353799304d03eb605f53
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Fri Sep 4 12:02:15 2020 -0700
WIP.
---
.../nlpcraft/server/rest/NCBasicRestApi.scala | 19 ++++++++-------
openapi/nlpcraft_swagger.yml | 28 +++++++++++-----------
2 files changed, 25 insertions(+), 22 deletions(-)
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/rest/NCBasicRestApi.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/rest/NCBasicRestApi.scala
index 7ba13a4..4ce8cd5 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/rest/NCBasicRestApi.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/rest/NCBasicRestApi.scala
@@ -488,6 +488,7 @@ class NCBasicRestApi extends NCRestApi with LazyLogging with NCOpenCensusTrace w
*/
protected def ask$Sync(): Route = {
entity(as[JsValue]) { req ⇒
+ //noinspection DuplicatedCode
val obj = req.asJsObject()
val acsTok: String = convert(obj, "acsTok", (js: JsValue) ⇒ js.convertTo[String])
@@ -505,11 +506,13 @@ class NCBasicRestApi extends NCRestApi with LazyLogging with NCOpenCensusTrace w
"usrExtId" → usrExtIdOpt.orNull,
"txt" → txt,
"mdlId" → mdlId) { span ⇒
- checkLength("acsTok", acsTok)
- checkLengthOpt("userExtId", data)
- checkLength("mdlId", mdlId)
+ checkLength(
+ "acsTok" -> acsTok,
+ "usrExtId" -> usrExtIdOpt,
+ "mdlId" -> mdlId,
+ "txt" -> txt
+ )
- checkLength("txt", txt, 1024)
checkLengthOpt("data", data, 512000)
val acsUsr = authenticate(acsTok)
@@ -548,10 +551,9 @@ class NCBasicRestApi extends NCRestApi with LazyLogging with NCOpenCensusTrace w
* @param fut
* @return
*/
- private def successWithJs(fut: Future[String]) =
- onSuccess(fut) {
- js ⇒ complete(HttpResponse(entity = HttpEntity(ContentTypes.`application/json`, js)))
- }
+ private def successWithJs(fut: Future[String]) = onSuccess(fut) {
+ js ⇒ complete(HttpResponse(entity = HttpEntity(ContentTypes.`application/json`, js)))
+ }
/**
*
@@ -712,6 +714,7 @@ class NCBasicRestApi extends NCRestApi with LazyLogging with NCOpenCensusTrace w
*/
protected def inspect$(): Route = {
entity(as[JsValue]) { req ⇒
+ //noinspection DuplicatedCode
val obj = req.asJsObject()
val acsTok: String = convert(obj, "acsTok", (js: JsValue) ⇒ js.convertTo[String])
diff --git a/openapi/nlpcraft_swagger.yml b/openapi/nlpcraft_swagger.yml
index 25cd19d..8b22d9f 100644
--- a/openapi/nlpcraft_swagger.yml
+++ b/openapi/nlpcraft_swagger.yml
@@ -162,9 +162,9 @@ paths:
post:
tags:
- Model
- summary: Model inspections.
+ summary: Performs model inspection.
description: >-
- Inspections for given model.
+ Inspections for given model. Administrative privileges required.
operationId: inspect
parameters:
- in: body
@@ -185,15 +185,15 @@ paths:
mdlId:
type: string
maxLength: 32
- description: Data model ID for which elements synonyms will be suggested
+ description: ID of the model to perform given inspection on
inspId:
type: string
maxLength: 32
- description: Inspection ID, currently supported are `macros`, `synonyms`, `intents` and `suggestions`
+ description: Inspection ID
args:
type: object
description: >-
- Inspection parameter. Currently supported `minScore` double value for `suggestions` inspection.
+ Inspection parameters.
responses:
'200':
description: Successful operation.
@@ -216,13 +216,13 @@ paths:
description: Failed operation.
schema:
$ref: '#/definitions/Error'
- /model/inspectons:
+ /model/inspecton/all:
post:
tags:
- Models inspections
summary: Gets all models inspections.
description: >-
- Gets all models inspections.. Administrative privileges required.
+ Gets all models inspections available. Administrative privileges required.
operationId: getAllInspections
parameters:
- in: body
@@ -287,28 +287,28 @@ paths:
- description
properties:
id:
- description: Parameters ID
+ description: Parameter ID
type: string
name:
- description: Parameters name
+ description: Parameter name
type: string
value:
- description: Parameters value
+ description: Parameter value
type: string
valueType:
- description: Parameters valueType
+ description: Parameter value type
type: string
synopsis:
- description: Parameters synopsis
+ description: Parameter synopsis
type: string
description:
- description: Parameters description
+ description: Parameter description
type: string
description:
description: Inspection description
type: string
isServerSide:
- description: Inspection `is-Server-Side` flag
+ description: Whether inspection runs on the server or the data probe
type: boolean
'400':
description: Failed operation.