-
Notifications
You must be signed in to change notification settings - Fork 22
fix: Add PHP open api generator for list operations #340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| } | ||
|
|
||
| private APIResources processCodegenOperations(List<CodegenOperation> opList) { | ||
| return new PHPAPIResourceBuilder(new PHPAPIActionTemplate(this), opList, this.allModels) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer CamelCase for Php and Api. Makes reading the name easier.
| return new PHPAPIResourceBuilder(new PHPAPIActionTemplate(this), opList, this.allModels) | ||
| .apiPath() | ||
| .additionalProps(directoryStructureService) | ||
| .template() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming is too generic. What does apiPath? Return the path, build the path, update the path? Same applies for the other names.
| public OperationsMap postProcessOperationsWithModels(final OperationsMap objs, List<ModelMap> allModels) { | ||
| final OperationsMap results = super.postProcessOperationsWithModels(objs, allModels); | ||
| final List<CodegenOperation> opList = directoryStructureService.processOperations(results); | ||
| APIResources apiResources = processCodegenOperations(opList); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like how clean this is. Should extend the refactoring to Node so we can see how this limits duplication as part of this review.
| public APIResourceBuilder operations(ISchemaResolver<CodegenParameter> codegenParameterIResolver) { | ||
| this.codegenOperationList.stream().forEach(codegenOperation -> { | ||
| codegenOperation.pathParams = codegenOperation.pathParams.stream().map(item -> | ||
| codegenParameterIResolver.resolve(item)).collect(Collectors.toList()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does it mean to resolve a parameter?
|
|
||
| import static com.twilio.oai.common.ApplicationConstants.PATH_SEPARATOR_PLACEHOLDER; | ||
|
|
||
| public class APIResources { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| public final static String META_LIST_PARAMETER_KEY = "x-list-parameters"; | ||
| public final static String META_CONTEXT_PARAMETER_KEY = "x-context-parameters"; | ||
|
|
||
| protected IAPIActionTemplate phpTemplate; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't be called php.
| public final static String TEMPLATE_TYPE_LIST = "list"; | ||
| public final static String TEMPLATE_TYPE_CONTEXT = "context"; | ||
| public final static String TEMPLATE_TYPE_OPTIONS = "options"; | ||
| public final static String TEMPLATE_TYPE_INSTANCE = "instance"; | ||
| public final static String TEMPLATE_TYPE_PAGE = "page"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these be defined in a non-php context?
| codegen.apiTemplateFiles().clear(); | ||
| codegen.apiTestTemplateFiles().clear(); | ||
| codegen.modelTestTemplateFiles().clear(); | ||
| codegen.apiDocTemplateFiles().clear(); | ||
| codegen.modelDocTemplateFiles().clear(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the codegen adapter already doing this?
|
|
||
| private Map<String, List<String>> mapping() { | ||
| return Map.ofEntries( | ||
| new AbstractMap.SimpleEntry<>("list", Arrays.asList("list.mustache", "List.php")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These keys are already defined elsewhere.
| // Path Solution | ||
| $this->solution = ['accountSid' => $accountSid, 'callSid' => $callSid, 'sid' => $sid, ]; | ||
| $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Calls/' . \rawurlencode($callSid) . '/Notifications/' . \rawurlencode($sid) . '.json'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not generic to all contexts.
|
[twilio-oai-generator-php] SonarCloud Quality Gate failed.
|
|
[twilio-oai-generator-java] Kudos, SonarCloud Quality Gate passed! |
|
[twilio-oai-generator-node] Kudos, SonarCloud Quality Gate passed! |
|
[twilio-oai-generator-go] Kudos, SonarCloud Quality Gate passed! |











Fixes
Checklist
make test-dockerpython examples/build_twilio_go.py path/to/twilio-oai/spec/yaml path/to/twilio-goand inspect the diffmake testintwilio-gotwilio-goIf you have questions, please create a GitHub Issue in this repository.