Skip to content

Commit

Permalink
chore: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mingxuanzhangsfdx committed Jan 30, 2025
1 parent 84e59ee commit ee7e3f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,18 @@ import { nls } from '../../messages';
import { ApexClassOASEligibleResponse, OpenAPIDoc } from '../schemas';
import { ProcessorInputOutput, ProcessorStep } from './processorStep';
export class MethodValidationStep implements ProcessorStep {
private diagnosticCollection: vscode.DiagnosticCollection;
static diagnosticCollection: vscode.DiagnosticCollection =
vscode.languages.createDiagnosticCollection('OAS Method Validations');
private className: string = '';
private virtualUri: vscode.Uri | null = null; // the url of the virtual YAML file
private diagnostics: vscode.Diagnostic[] = [];
constructor() {
this.diagnosticCollection = vscode.languages.createDiagnosticCollection('OAS Method Validations');
}
constructor() {}
process(input: ProcessorInputOutput): Promise<ProcessorInputOutput> {
this.className = input.context.classDetail.name;
this.className = input.context.classDetail.name as string;
this.virtualUri = vscode.Uri.parse(`untitled:${this.className}_OAS_temp.yaml`);
this.diagnosticCollection.clear();
MethodValidationStep.diagnosticCollection.clear();
const cleanedupYaml = this.validateMethods(input.yaml, input.eligibilityResult);
this.diagnosticCollection.set(this.virtualUri, this.diagnostics);
MethodValidationStep.diagnosticCollection.set(this.virtualUri, this.diagnostics);
input.errors = [...input.errors, ...this.diagnostics];
return new Promise(resolve => {
resolve({ ...input, yaml: cleanedupYaml });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class MethodByMethodStrategy extends GenerationStrategy {

for (const doc of docs) {
const yamlCleanDoc = this.cleanYamlString(doc);
const parsed = parse(yamlCleanDoc) as OpenAPIV3.Document;
const parsed = yaml.parse(yamlCleanDoc) as OpenAPIV3.Document;
// Merge paths
if (parsed.paths) {
for (const [path, methods] of Object.entries(parsed.paths)) {
Expand Down

0 comments on commit ee7e3f6

Please sign in to comment.