Closed bbrala closed 3 years ago
Looks good so far! Just 2 things that need adjustment: The php version in the composer.json needs adjust as mentioned above. And the test runner should do a run on php7.4 and 8.0.
I've made the requested changes.
Hmm, the url's that are generates are not correct. It generated a serverUrl of: https://server.com/api/v1
and then resource urls of api/v1/resource
this means the api/v1
part is doubled.
How about this?
$this->uri = str_replace(
$route->getPrefix(),
'',
$route->uri()
);
If i look at how the data should be formatted, that should be fine? Added a test to test for url and a path.
Hmm, i was thinking, you might just want the server url without the base url as you mentioned so you can generate on dev and publish without a problem.
If I remember correctly the getPrefix
method on the route just works for the "base level" routes of the resource. For any nested routes like for example the relationships, the prefix contains the resource part itself. For api/v1/resource/relationships/another
the prefix would be api/v1/resource/relationships
.
Hmm, i was thinking, you might just want the server url without the base url as you mentioned so you can generate on dev and publish without a problem.
Yes, I support this. It would ideal to add a mechanism to allow devs to inject the real server url afterwards. This way it is possible to generate the specs in an CD pipeline and publish the generated spec in Swagger UI or Redoc somewhere.
Maybe the best way would be a public getter on the Server
class directly in the open api package. This way, the "old method" works fine and we get a pure URI prefix without the domain part.
Today is my last day of exams, afterwards I will be again more active in the development!
I've updates the route generation to be correct for relationships.
I think that you should be able to configure servers in the config file. And then on the server url level. This way you can add an acceptance and production url which should be able to serve this.
I do think that this should live in a seperatie issue though and not block this.
This looks good now!
I've changed a few things to get this to work properly op php 7.4. This seems to work pretty well like this, i did also change the max examples to 3 since i was kinda running into problems there.
When generating the yml i see a few places where thing do not compute completely, but that is not really related to this change. Ill open a separate issue.