-
Notifications
You must be signed in to change notification settings - Fork 105
Developed web api xml file generation, web api xml declaration generation, improved action development experience, added PhpPsiElementsUtil #548
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
…tion, improved action development experience, added PhpPsiElementsUtil
…plugin into entity-web-api-generation
final PhpDocComment classDocComment = method.getContainingClass().getDocComment(); | ||
|
||
if (!method.getAccess().isPublic() | ||
|| method.getName().equals("__construct") |
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.
We have the same string literal here: com.magento.idea.magento2plugin.magento.files.Plugin#CONSTRUCT_METHOD_NAME
Could you please put them in some unified place?
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.
Done.
private final String aclResource; | ||
|
||
/** | ||
* Web Api xml declaration DTO constructor. |
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.
* Web Api xml declaration DTO constructor. | |
* Web API XML declaration DTO constructor. |
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.
Done
for (final String method : HttpMethod.getHttpMethodList()) { | ||
httpMethod.addItem(new ComboBoxItemData(method, method)); | ||
} | ||
aclResource = new FilteredComboBox(new LinkedList<>(Arrays.asList("self", "anonymous"))); |
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.
"self", "anonymous" should be moved to an enum
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.
Done.
public class NewWebApiDeclarationAction extends AnAction { | ||
|
||
public static final String ACTION_NAME = "Create a new WebApi declaration for this method"; | ||
public static final String ACTION_DESCRIPTION = "Create a new Magento 2 WebApi XML declaration"; |
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 static final String ACTION_DESCRIPTION = "Create a new Magento 2 WebApi XML declaration"; | |
public static final String ACTION_DESCRIPTION = "Create a new Magento 2 Web API XML declaration"; |
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.
Done.
|
||
public class NewWebApiDeclarationAction extends AnAction { | ||
|
||
public static final String ACTION_NAME = "Create a new WebApi declaration for this method"; |
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 static final String ACTION_NAME = "Create a new WebApi declaration for this method"; | |
public static final String ACTION_NAME = "Create a new Web API declaration for this method"; |
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.
Done.
} | ||
|
||
/** | ||
* Generate WEB API xml declaration. |
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.
* Generate WEB API xml declaration. | |
* Generate Web API XML declaration. |
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.
Done.
…plugin into entity-web-api-generation
055c105
to
41abad4
Compare
@VitaliyBoyko Requested changes implemented. Thank you! |
…plugin into entity-web-api-generation
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.
Hi @bohdan-harniuk, really good feature.
Additionally, I'm thinking if it worth having some more resource than anonymous
an self
. Since we create our own resources via EntityManager, maybe it also makes sense to list all the available resources
?
cc. @VitaliyBoyko
Hi @eduard13 I thought about it either. |
…to2-phpstorm-plugin into entity-web-api-generation
Hello, @VitaliyBoyko ! Thank you for your good suggestion about a useless mandatory requirement to have @api in the class doc. I removed it. Now it looks better. |
Description (*)
The main purpose of this PR is to generate web api xml declaration for a service. Generation action is accessible from the context menu if you click on the public method name. Also, it is required for the class to have @api declaration in the annotation. Also, added test for testing this generation.
Contribution checklist (*)