Changeset 3358117
- Timestamp:
- 09/08/2025 06:24:59 PM (5 months ago)
- Location:
- wp-openapi/trunk
- Files:
-
- 6 edited
-
readme.txt (modified) (1 diff)
-
src/SchemaGenerator.php (modified) (2 diffs)
-
src/Spec/Operation.php (modified) (1 diff)
-
src/Util.php (modified) (1 diff)
-
vendor/composer/installed.php (modified) (2 diffs)
-
wp-openapi.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wp-openapi/trunk/readme.txt
r3330759 r3358117 5 5 Tested up to: 6.7.2 6 6 Requires PHP: 7.1 7 Stable tag: 1.0.2 17 Stable tag: 1.0.22 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html -
wp-openapi/trunk/src/SchemaGenerator.php
r3330759 r3358117 73 73 $schema = call_user_func( $options['schema'] ); 74 74 if ( isset( $schema['title'] ) ) { 75 $schemaTitle = $schema['title']; 75 $title = Util::normalizeSchemaTitle( $schema['title'] ); 76 $schemaTitle = $title; 76 77 $base['components']['schemas'][ $schemaTitle ] = $schema; 77 78 } … … 152 153 } 153 154 155 // Manually fix these endpoints from WooCommerce. 156 $fixList = [ 157 'install_async_schema', 158 'install_and_activate_schema', 159 'count_low_in_stock_items' 160 ]; 161 162 // Hate this fix, but we don't have control over other plugins. 163 foreach ($fixList as $schemaKey) { 164 if (isset($base['components']['schemas'][$schemaKey]) && isset($base['components']['schemas'][$schemaKey]['properties']['properties'])) { 165 $base['components']['schemas'][$schemaKey]['properties'] = $base['components']['schemas'][$schemaKey]['properties']['properties']; 166 foreach ($base['components']['schemas'][$schemaKey]['properties'] as $key => $property) { 167 if (is_string($property)) { 168 $base['components']['schemas'][$schemaKey]['properties'][$key] = array('type' => Util::normalzieInvalidType($property)); 169 } 170 } 171 } 172 } 173 154 174 return $base; 155 175 } -
wp-openapi/trunk/src/Spec/Operation.php
r3330759 r3358117 183 183 } 184 184 } 185 186 // Loop through again make sure it's not an empty array. 187 foreach ($properties as $key => $property) { 188 if (is_array($property) && count($property) === 0) { 189 $properties[$key] = new \stdClass(); 190 } 191 foreach ($property as $propKey => $propValue) { 192 if ($propKey === 'items' && is_string($propValue)) { 193 $properties[$key]['items'] = array('type' => Util::normalzieInvalidType($propValue)); 194 } 195 } 196 } 197 198 185 199 return $properties; 186 200 }); -
wp-openapi/trunk/src/Util.php
r3269185 r3358117 70 70 return $enum; 71 71 } 72 73 public static function normalizeSchemaTitle( $title ) { 74 // Remove invalid characters for schema titles. 75 // Only allow alphanumeric characters and underscores. 76 $title = preg_replace( '/[^a-zA-Z0-9_]/', '_', $title ); 77 // Ensure the title starts with an alphabetic character or underscore. 78 if ( ! preg_match( '/^[a-zA-Z_]/', $title ) ) { 79 $title = '_' . $title; 80 } 81 82 83 return strtolower( $title ); 84 } 72 85 } -
wp-openapi/trunk/vendor/composer/installed.php
r3330759 r3358117 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' a3c9ca1226d1e30a10ce9268ca8d91e72f855570',6 'reference' => '08ebd2d7eca722986a50dc7da97d0277bb53b3ba', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-main', 15 15 'version' => 'dev-main', 16 'reference' => ' a3c9ca1226d1e30a10ce9268ca8d91e72f855570',16 'reference' => '08ebd2d7eca722986a50dc7da97d0277bb53b3ba', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../', -
wp-openapi/trunk/wp-openapi.php
r3330759 r3358117 10 10 * Plugin Name: WP OpenAPI 11 11 * Plugin URI: https://github.com/moon0326/wp-openapi 12 * Version: 1.0.2 112 * Version: 1.0.22 13 13 * Author: Moon K 14 14 * Author URI: https://github.com/moon0326
Note: See TracChangeset
for help on using the changeset viewer.