Skip to content
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

Reference with namespace in Annotations\Items #123

Closed
wants to merge 2 commits into from

Conversation

raciat
Copy link

@raciat raciat commented Jan 22, 2014

I've changed regular expression pattern (by adding backslash as allowed character) to be able to use namespace in $ref variable for items e.g. @SWG\Property(items="$ref:Api\Categories\CategoriesEntity"). It was possible before only by using @SWG\Property(@SWG\Items("Api\Categories\CategoriesEntity")) notation.

@bfanger
Copy link
Collaborator

bfanger commented Jan 22, 2014

This is similar to the #122 pull request. i've havent merged it (yet) because the swagger spec is moving towards the json-scheme.org specification for models, which also allows for urls and "URI-encoded JSON Pointers" in a $ref.

But I haven't found the time to investigate which are supported by swagger-ui and how this would affect swagger-php.
Adding support \ is an improvement, but i'm leaning towards matching anything \$ref:(.+$)

What do you think?

@raciat
Copy link
Author

raciat commented Jan 22, 2014

Imho a reference in this case means type of an object, so we can use either class name or class name with the namespace. In both cases we can't use special characters except \.
Do we want to use type like T^p%20e? I don't think so...

In the #122 there is also a change in Swagger.php file. In my case I don't think it was necessary, but I can be wrong.

@bfanger
Copy link
Collaborator

bfanger commented Jan 22, 2014

The less opinions the parser has the better. Its important that Swagger-PHP generates predictable output.
(which it failed to do with namespaces and underscores)
So if someone wants to use T^p%20e as $ref so be it.

I've released 0.9.0 which adds support any $ref notation.

@bfanger bfanger closed this Jan 22, 2014
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.

2 participants