cebe / cebe/php-openapi

Missing functions to remove elements ?

オープン
#153 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement
主要言語
PHP
スター
500
フォーク
99
PR マージ指標
30日以内にマージされた PR はありません

説明

Hi,

I've been working on a project that would allow to take a full OAS Definition file and create a stripped down version using only a subset of the original endpoints, tags, webhooks, etc.

I want to remove internal functions based on a "x-internal" attributes.

I also want to create different versions of an api definition based on a "x-presentations" attributes.

So Far, I was able to remove uneeded:
- "paths" using paths->removePath('/path')
- "operations" using unset(pathItem->post)

But now I am struggling to find a way to remove other types of elements.
For example:
- Trying to remove a schema using
unset($openapi->components->schemas['foo']);
Give an error: "PHP Notice: Indirect modification of overloaded property cebe\openapi\spec\Components::$schemas has no effect"
- Trying to delete an element from x-Webhooks gives the same kind of error
- Tags doesn't seem to be possible at all since Tag Item are added to an unindexed array...

I am considering forking the project and starting to work on fixes for that but before I do I'd like to know:
1- If I'm doing something wrong and it's already possible to remove object. If so, I would appreciate a pointer.
2- If it's not possible, would you consider to improve the library to include the new functionality ? Or are you considering this as irrelevant to the project ? I'd be willing to help if you do.

If we can find a way to remove elements, I would also implement a function to remove unused elements automatically using a recursive referencing counter algorithm detecting unused elements.

Thanks in advance

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

既存の paths->removePath('/path') と operation-unset の例から始め、その後、Components::$schemas、x-Webhooks、tags がどのように表現されているかを確認します。オーバーロードされたプロパティの通知を再現し、各要素を削除する方法を特定します。schemas、webhooks、tags をエラーなしで削除できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
php
領域
api
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。