yiisoft / yii-api

Yii REST API framework
BSD 3-Clause "New" or "Revised" License
93 stars 22 forks source link

Does this repo need depend yii-web? #27

Closed kids-return closed 4 years ago

kids-return commented 5 years ago

currently yii-web is depend view yii-rest does not need depend view I don't think this repo needs to depend on yii-web.

kids-return commented 5 years ago

need to slice the yii-web public part into a repo

samdark commented 5 years ago

It shares a big pack of similarities since REST functions over HTTP: request/response, headers, content type negotiation etc.

tomlutzenberger commented 5 years ago

Splitting yii-web up even further would result in a huge amount of unnecessary work. Since yii-rest is also web-related it makes sense as is.

kids-return commented 5 years ago

@tomlutzenberger If we don't separate yii-web then we can merge yii-rest into yii-web, this repo will have no meaning. So yii-web also needs to be merged into yii-core, because yii-web also depends to yii-core. This will cause us to return to the state of yii2.0. The time during this period is wasted. We will always cycle between cutting and merging.

I think separation is correct. We should now concentrate all our efforts on solving problems in the process of separation.

for now, we only need to address the dependencies between yi-web and yi-rest to implement all the features of yii2.0.

Reference: https://github.com/yiisoft/yii-project-template/issues/12 https://github.com/yiisoft/yii-web/pull/27

kids-return commented 5 years ago

need to slice the yii-web public part into a repo

or yii-web depend yii-rest , the generic part is moved to yii-rest, yii-web for rewriting

kids-return commented 5 years ago

This problem also needs to be solved See: https://github.com/yiisoft/view/issues/6

kids-return commented 5 years ago

@samdark @cebe @hiqsol @schmunk42 @SilverFire @klimov-paul @rob006 What do you think? Yii3.0 does not need to consider BC

samdark commented 5 years ago

Separation is fine: REST part isn't needed if you want web only but main reason for it is to make releases, issues and maintenance independent at least to some degree.

samdark commented 5 years ago

@kids-return how would you implement HTTP features needed for REST w/o reusing web part?

kids-return commented 5 years ago
  1. Put the public part in a separate repo. (I don't know how to name this repo)
  2. Put it in the core
  3. Put it in yii-rest, yii-web depend yii-rest (this will ensure the minimization of yii-rest)

This is what I can think of now, I will find out if there are other separation schemes.

kids-return commented 5 years ago

I prefer the first one.

I am currently being plagued by this problem, I think there should be a lot of repo. Can you help me? https://github.com/yiisoft/db/issues/29

samdark commented 5 years ago

I think variant 3 is fine for now.

cebe commented 5 years ago

this depends on how much yii-web includes asset related stuff.

samdark commented 5 years ago

Pretty much all of it.

kids-return commented 5 years ago

Is there a result now? I found that yii-rest is increasingly dependent on yii-web. If you use scenario 3, we should move the relevant work to this repo as soon as possible. Currently yii-base-api is no longer working. I think we should focus on solving these dependencies first, so that we can avoid a lot of meaningless work. E.g. yii-base-api can't work, I have to go to a lot of related repo, check commit, it's painful

kids-return commented 5 years ago

I can't fix before I don't know the result. ☹️

machour commented 5 years ago

I vote for solution 3.

kids-return commented 5 years ago

I vote for solution 3.

samdark commented 5 years ago

3, as I said before.

kids-return commented 5 years ago

I have started to try the related work, my steps are as follows step 1 Move the relevant files from yii-web to ensure that yii-rest works properly. step 2 Make yii-web depend on yii-rest. Remove unrelated files from yii-web and make yii-web difference file extend yii-rest step 3 Fix file comments related content step 4 Move and fix tests step 5 Move and fix docs.

Of course, problems may occur in the process. But the promotion will be better than the stagnation. After doing some work, I found that it might be better to separate http from yii-core to yii-http. Because it is more appropriate to put yii-rest and yii-web the same content to yii-http. But I want to advance according to the above steps. Other related issues will be discussed at the appropriate time

samdark commented 5 years ago

Wait, wait. By number 3 I've meant rest depends on web, not vice versa.

HTTP is in yii-web currently, not in yii-core.

kids-return commented 5 years ago

yii-rest depends on yii-web? Then yii-rest indirectly depends on view? But in most cases yii-rest does not need to rely on view! How to implement api framework like Lumen and Slim

kids-return commented 5 years ago

How can the current yii-base-api work properly?

samdark commented 5 years ago

Logically, REST depends on HTTP, PSR-7 request-response, formatters. In reality you need a page with API documentation that is likely to use view.

samdark commented 5 years ago

So it seems separating yii-http could be a good idea.

kids-return commented 5 years ago

No matter which method use I only hope that we can move forward,Instead of stagnation. There are many other problems on the way forward. If we don’t advance, we will never find the next problem.

kids-return commented 5 years ago

I want to advance according to my ideas. If you end up against it, or have a better plan, then proceed with git reset.

machour commented 5 years ago

@samdark

In reality you need a page with API documentation that is likely to use view.

Logically, in this case, you would install and use yii-web, no?

I was understanding 3 the other way around (web would depend on rest), but to be fair, having either one of those libs depend on the other would be weird.

Having yiisoft/yii-http implementing PSR-7 could be a nicer way to address our present issue. (@rob006 I'm curious, what are your arguments against this?)

rob006 commented 5 years ago

I'm curious, what are your arguments against this?

Lack of sufficient arguments in favor of extracting another package. I was already against extracting view package because there is no real reason to do this ("you may not need some stuff" is not a valid reason for creating another package). Creating yii-http looks like an escalation of this over-abstracting madness, only to solve a problem which should not exist in the first place :D.

kids-return commented 5 years ago

So how do we now need to make yi-rest and yii-base-api work?

kids-return commented 5 years ago

How about letting it run first? What do you need to do next? ? ? ? ? ?

samdark commented 5 years ago

We've discussed it with @machour in private and decided that yii-rest should depend on yii-web.

samdark commented 5 years ago

Sorry for getting back and forth, @kids-return.

jasonmccallister commented 5 years ago

@samdark if I only wanted to build a REST API and yii-rest which depends on yii-web which includes yii-view, do I need views to implement a REST API?

Ideally, if I only wanted to build a REST API and use Yii as a micro-framework, I am now dependent upon yii-views.

Sorry to bump this topic, but I was working on the documentation for https://github.com/yiisoft/docs/issues/32 and stumbled upon this dependency issue.

My specific use case is different as I am working on deploying Yii3 with Bref (Lambda) so extra dependencies are hot on my list. Truth be told, this is not a show stopper to include view, but as we add more dependencies my Lambda dependency/size limit gets closer to the max.

samdark commented 5 years ago

This repo is not ready. As for yii-web, https://github.com/yiisoft/yii-web/issues/136

samdark commented 5 years ago

View dependency was not necessary for yii-web. Killed.

xepozz commented 4 years ago

Can be closed?