-
Notifications
You must be signed in to change notification settings - Fork 934
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
Global unified configuration suggestions #1623
Comments
@DerManoMann Big Boss, can this new configuration method be adapted? I know this involves many functions, but this one feels much more convenient to use. |
Could be - I can see how the annotations and the class itself could work. However, there still would need to be some (more) code somethwere to actually use and call it? |
I guess something like this would mostly do the trick (actual implementation missing) - everything additional around it would have to be part of the codebase that actually uses the builder. The path mappings translate to plugin config, as could the customizers if a corresponding new processor was added... Not sure what the class OpenApiBuilder
{
public function group(string $group): OpenApiBuilder
{
return $this;
}
/**
* @param string|array $paths
*/
public function pathsToMatch($paths): OpenApiBuilder
{
return $this;
}
/**
* @param class-string<AbstractAnnotation> $class
*/
public function addCustomizer(string $class, callable $customizer): OpenApiBuilder
{
return $this;
}
public function build(): Generator
{
return new Generator();
}
} |
... I guess you can tell I am curious :) I will have a play around - maybe its time to start working on my openapi-extras package again ;) |
Yeah, but that is not part of the spec that is generated, right? |
I'm glad you're curious about this feature, and it makes me excited. If there's anything I can do to help, please feel free to ask. I'll continue to study the Java implementation and polish it into our PHP implementation. |
Keep in mind that swagger-php is only concerned with generating the spec, not with managing multiple versions or rendering a UI. |
Yes, although this is not the swagger specification, it will generate swagger specification data, and the swagger UI also supports this implementation. |
So how would the group show up in the YAML? |
You need to generate multiple YAML files. When you switch the selection, different YAML files will be used. |
See, that is my point - generating multiple files is outside of the scope of the library, IMO. |
I understand, but this feature will provide a more convenient use solution without affecting the generated specifications. This is something exciting for us developers because we will have more advanced features for quick use and development. |
I have come up with a solution that may be of interest to you: php-swagger only needs to implement the above configuration functions, transferring the configuration from comments/annotations to configuration methods, and does not need to implement the group method, which is implemented by other extensions. |
Extension is equivalent to wrapping a layer for php-swagger to achieve more functions. php-swagger provides a single underlying service. Currently, the following configuration needs to be implemented through comments/annotations, which is not conducive to expanding its capabilities.
|
Each |
I wrote a code example that illustrates the functionality of php-swagger and the extensions that need to be implemented.
|
Not sure I agree with where the responsibilities are, but the core of the
We can start somewhere and that is the I suggest moving the discussion to DerManoMann/openapi-extras#10, which is where the draft of the builder can be seen. It is worth noting that the extra library allows sharing of a prefix, headers and responses within a single controller class already via annotations/attributes, so the builder add another way of doing it (on global level) |
Yes, it is possible to implement the core functions by OpennApiBuilder and single YAML and multi-YAML configuration by L5. I checked the relevant documents and found that SwaggerUIBundle supports passing in However, I have a question. At present, L5 does not seem to have separate configurations for @OA\Server and @OA\Info. Can it realize different document versions and descriptions for different documents? |
The current configuration of L5 is as follows:
But I want to achieve this, which means that sharing Server, Info is not desirable because different documents have different definitions:
|
S you still missing a customised for the server details then? |
Yes, The need for grouping is generally to provide documents for different systems, so the descriptions and interface suffixes will also be different. |
For example, I currently have such a scenario. I will provide interfaces and corresponding interface documents for partners and merchants respectively.
|
This should be a good starting point and provide everything to implement this for a specific framework bundle/plugin. Something like:
|
good, when is this extension expected to be merged and released? |
In addition, if I want to use I need to build different documents and then need a UI to display the documents. If it is a combination of Of course, |
I'd like to know your opinion, and then I'll file an issue in l5-swagger if necessary. |
https://github.com/DerManoMann/openapi-extras/releases/tag/2.0.1 |
I suppose you'd have to use all three at the same time, yes. And, yes, this would require changes in l5. Not sure if anyone there is interested in those, but if it would allow to manage multiple versions then perhaps there is interest. |
Maybe I should develop a new package based on If I have time in the near future, I will develop a new package based on this. |
I have used the Java
springdoc-openapi-starter-webmvc-ui
package. In the global configuration, I think it is better than the existing PHP swagger package configuration scheme.This is a solution that I conceived based on the Java swagger configuration. Based on this configuration, multiple YAMLs will be generated. Swagger UI will support switching between multiple configurations.
Java swagger also supports single YAML. It supports both schemes. It seems that it is just the result of different annotations. If necessary, I can also provide relevant references.
tip: The final generated YAML is in line with the swagger specification, but in terms of user and dev experience, it will be more unified and convenient.
The text was updated successfully, but these errors were encountered: