Skip to content

Code Review Week 2#2

Open
MarcoDoell wants to merge 21 commits intodiff2from
diff3
Open

Code Review Week 2#2
MarcoDoell wants to merge 21 commits intodiff2from
diff3

Conversation

@MarcoDoell
Copy link
Owner

No description provided.

export class HttpImporter extends Importer {

//TODO RuntimeParameters type is probably wrong
parameters:ImporterParameterDescription[] = [new ImporterParameterDescription({name:"location", description:"String of the URI for the HTTP call", type:"string"}),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternative design idea:

Use an interface instead of a class for parameter descriptions (since no behavior, just plain data)
TypeScript
export interface ImporterParamDescription {
name: string;
description: string;
type: string;
}


Use a record ("as a map"). Not sure if we need this though.
```TypeScript
parameters: Record<string, ImporterParamDescription> = {
  'location': {
    name: 'location',
    description: '....',
    type: 'string'
  }
}

illegalArgumentsMessage = illegalArgumentsMessage + this.type + "importer requires parameter " + requiredParameter.name + "\n";
}
// TODO is that OK?
else if((inputParameters.get(requiredParameter.name) as any).constructor.name != requiredParameter.type){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks weird. What are you trying to compare here?

//TODO @Georg: need to check how to store the class in typescript, can use instance.constructor.name to get the name probably -> is stored as string
type: unknown;

constructor ({name,description,required=true,type}: {name:string, description:string, required?:boolean, type:unknown}) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ImporterParameterDescription sould be a simple interface since no behavior

import { HttpImporter } from "../../importer/HttpImporter";
import { Importer } from "../../importer/Importer";

export class Protocol {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think having this construct does not make sense in TypeScript.

rather just

export Protocol = {
   HTTP: new HttpImporter()
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants