Add auto-model mock API scenario (#2684)
This commit is contained in:
@@ -91,11 +91,14 @@ interface CodeSearchRequest {
|
|||||||
interface AutoModelRequest {
|
interface AutoModelRequest {
|
||||||
request: {
|
request: {
|
||||||
kind: RequestKind.AutoModel;
|
kind: RequestKind.AutoModel;
|
||||||
|
body?: {
|
||||||
|
candidates: string;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
response: {
|
response: {
|
||||||
status: number;
|
status: number;
|
||||||
body?: {
|
body?: {
|
||||||
candidates: string;
|
models: string;
|
||||||
};
|
};
|
||||||
message?: string;
|
message?: string;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -231,8 +231,8 @@ function createAutoModelRequestHandler(
|
|||||||
// During automodeling there can be multiple API requests for each batch
|
// During automodeling there can be multiple API requests for each batch
|
||||||
// of candidates we want to model. We need to return different responses for each request,
|
// of candidates we want to model. We need to return different responses for each request,
|
||||||
// so keep an index of the request and return the appropriate response.
|
// so keep an index of the request and return the appropriate response.
|
||||||
return rest.get(
|
return rest.post(
|
||||||
`${baseUrl}/code-scanning/codeql/auto-model`,
|
`${baseUrl}/repos/github/codeql/code-scanning/codeql/auto-model`,
|
||||||
(_req, res, ctx) => {
|
(_req, res, ctx) => {
|
||||||
const request = autoModelRequests[requestIndex];
|
const request = autoModelRequests[requestIndex];
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"request": {
|
||||||
|
"kind": "autoModel"
|
||||||
|
},
|
||||||
|
"response": {
|
||||||
|
"status": 200,
|
||||||
|
"body": {
|
||||||
|
"models": "extensions:\n- addsTo: {extensible: sinkModel, pack: codeql/java-all}\n data:\n - [javax.servlet.http, HttpServletResponse, true, sendRedirect, (String), '', 'Argument[this]',\n request-forgery, ai-generated]\n - [javax.servlet.http, HttpServletResponse, true, sendRedirect, (String), '', 'Argument[0]',\n request-forgery, ai-generated]\n"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"request": {
|
||||||
|
"kind": "autoModel"
|
||||||
|
},
|
||||||
|
"response": {
|
||||||
|
"status": 200,
|
||||||
|
"body": {
|
||||||
|
"models": "extensions:\n- addsTo: {extensible: sinkModel, pack: codeql/java-all}\n data:\n - [javax.servlet, MultipartConfigElement, true, MultipartConfigElement, (String),\n '', 'Argument[0]', request-forgery, ai-generated]\n"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
This scenario is best when modeling the `javax.servlet-api` package.
|
||||||
Reference in New Issue
Block a user