File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -526,12 +526,17 @@ defmodule OpenAPI.Processor.Naming do
526
526
527
527
@ doc false
528
528
def segment_identifier ( input ) do
529
- input
530
- |> String . split ( ~r/ [^A-Za-z0-9]+|([A-Z]?[a-z0-9]+)/ , include_captures: true , trim: true )
529
+ [ first_segment | segments ] =
530
+ String . split ( input , ~r/ [^A-Za-z0-9]+|([A-Z]?[a-z]+)|([0-9]+)/ ,
531
+ include_captures: true ,
532
+ trim: true
533
+ )
534
+
535
+ first_segment = String . replace ( first_segment , ~r/ ^[^A-Za-z]+/ , "" )
536
+
537
+ [ first_segment | segments ]
531
538
|> Enum . map ( fn segment ->
532
- segment
533
- |> String . replace ( ~r/ ^[^A-Za-z]+/ , "" )
534
- |> String . replace ( ~r/ [^A-Za-z0-9]+$/ , "" )
539
+ String . replace ( segment , ~r/ [^A-Za-z0-9]+$/ , "" )
535
540
end )
536
541
|> Enum . reject ( & ( & 1 == "" ) )
537
542
end
You can’t perform that action at this time.
0 commit comments