{"id":20710970,"url":"https://github.com/entur/netex-validator-java","last_synced_at":"2025-12-24T06:27:44.249Z","repository":{"id":37091679,"uuid":"447567464","full_name":"entur/netex-validator-java","owner":"entur","description":"Validate NeTEx dataset against the Nordic NeTEx profile","archived":false,"fork":false,"pushed_at":"2024-12-11T13:34:33.000Z","size":887,"stargazers_count":1,"open_issues_count":4,"forks_count":0,"subscribers_count":18,"default_branch":"main","last_synced_at":"2024-12-11T14:48:06.724Z","etag":null,"topics":["ror"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"eupl-1.2","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/entur.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-13T11:05:20.000Z","updated_at":"2024-12-11T13:33:42.000Z","dependencies_parsed_at":"2023-11-13T01:35:51.916Z","dependency_job_id":"2cfd5035-4d75-4ce3-bc9d-8c6a19f40270","html_url":"https://github.com/entur/netex-validator-java","commit_stats":null,"previous_names":[],"tags_count":120,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/entur%2Fnetex-validator-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/entur%2Fnetex-validator-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/entur%2Fnetex-validator-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/entur%2Fnetex-validator-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/entur","download_url":"https://codeload.github.com/entur/netex-validator-java/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242981918,"owners_count":20216502,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ror"],"created_at":"2024-11-17T02:13:40.173Z","updated_at":"2025-12-24T06:27:44.236Z","avatar_url":"https://github.com/entur.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NeTEx validator Java\n\nValidation library for NeTEx data.  \nThe library analyzes NeTEx datasets and generates a validation report. \nIn addition to XML schema validation, the library applies a configurable set of validation rules (See list below).  \nThe library is intended primarily to support the validation of datasets compliant with the [Nordic NeTEx Profile](https://enturas.atlassian.net/wiki/spaces/PUBLIC/pages/728891481/Nordic+NeTEx+Profile).  \nIt expects the dataset to follow the packaging and naming conventions stated in the Nordic NeTEx profile (dataset packaged as a zip file, one NeTEx Line per XML file, shared file prefixed with `_`, ...)\n\n## Input data\nThe validator requires:\n- The NeTEx codespace of the timetable data provider.\n- A NeTEx file containing the timetable data.\n- A unique id (string) identifying the validation run.\n\n## Output\nThe validator produces a **ValidationReport** object that contains a list of **ValidationReportEntry** instances.\nA **ValidationReportEntry** represents a unique validation finding identified by:\n- the name of the validation rule,\n- the context-specific validation message,\n- the severity of the finding (INFO, WARNING, ERROR),\n- the name of the file being analyzed.\n\n## XML Schema validation\nThe entry point **NetexValidatorsRunner** runs by default an XML Schema validation as the first step in the validation process.  \nThis validation step is blocking: in case of an XML Schema validation error, further validations are skipped. \n\n## XPath validation\nThe entry point **NetexValidatorsRunner** can be configured with a list of XPath validators.  \nXPath validators are run after XML schema validation.  \nXPath validators assert validation rules by executing XPath queries on the NeTEx document.   \nThis validation step is blocking: in case of a validation error, further validations are skipped.\n\n## JAXB validation\nThe entry point **NetexValidatorsRunner** can be configured with a list of JAXB validators.  \nJAXB validators are run after XML schema validation and XPath validation.  \nJAXB validators assert validation rules by navigating a (JAXB) object model of the NeTEx document.  \nThe object model makes it easier to validate more complex rules than XPath validators. On the other hand, these\nvalidators expect that the NeTEx document is well-formed and that the NeTEx entities required by the NeTEx profile are present.  \nIt is therefore recommended that any assumption made by JAXB validators are asserted during the XPath validation step.\n\n## Configurable validators\nThe entry point **NetexValidatorsRunner** can be configured with a list of **NetexValidator** instances that are executed sequentially during a validation run, after a successful XML Schema validation.\n\nThe library offers default implementations for:\n- XPath validation\n- NeTEx id uniqueness validation\n- NeTEx reference consistency check\n\nThe library can be extended with custom NetexValidator implementations (see [Antu](https://github.com/entur/antu) for examples of Entur-specific validators)\n\n## Configurable rule severity and description\nEach rule is defined with a default name, severity (INFO, WARNING, ERROR, CRITICAL) and a parameterized message in English.\nThe name, severity and message can be customized/internationalized in a configuration file (YAML).  \nThe message field can contain placeholders that follow the String.format() conventions.  \nThe default configuration file is named ```configuration.default.yaml```\n\nInternationalization example: \n```\n- code: TRANSPORT_MODE_ON_LINE\n  name: Mode de transport invalide\n  message: Le mode de transport %s est invalide\n  severity: WARNING\n ```\n\n## Parallel processing and thread-safety\nThe library is thread-safe and can execute validations in parallel within the same JVM, though some NetexValidator implementations may require synchronization.\nThis is the case in particular for the NeTEx id uniqueness validation, since it checks uniqueness across several files.\nSee [Antu](https://github.com/entur/antu) for examples of distributed validation across several Kubernetes pods.\n\n## Development guide\n\n### Adding new XPath validation rules\nSimple XPath validation rules can be implemented with the following generic ValidationRules:\n- ValidateNotExist\n- ValidateAtLeastOne\n- ValidateExactlyOne\n\nExample:\n```java\nValidationRule rule = new ValidateNotExist(\"lines/*[self::Line or self::FlexibleLine][not(TransportMode)]\", \"Missing TransportMode on Line\", \"LINE_4\");\n```\n\nMore complex rules can be implemented by extending these generic ValidationRules or implementing the ValidationRule interface.\n\n### Registering an XPath validation rule\nXPath rules must be registered in a ValidationTree to be applied on a NeTEx document.\nThe library comes with a default validation tree (see DefaultValidationTreeFactory) that can be extended with custom rules.\n\n### Implementing custom NeTEx validators\nOther types of NeTEx validators can be added by implementing the NetexValidator interface.\nSee NetexIdUniquenessValidator for an example.\n\n### Registering validators\nValidators must be registered in a NetexValidatorsRunner.\nThe method NetexValidatorsRunner.validate() is the entry point for running a validation.  \nIt executes the registered NeTEx validators and returns a ValidationReport containing the validation findings.\n\nExample (see also **Demo.java** for an executable example)\n```java\n// create a NeTEx XML Parser that ignores SiteFrame elements\nNetexXMLParser netexXMLParser = new NetexXMLParser(Set.of(\"SiteFrame\"));\n// create a NeTEx schema validator, limit the number of findings to 100\nNetexSchemaValidator netexSchemaValidator = new NetexSchemaValidator(100);\n// create a custom NeTex validator\nNetexValidator netexValidator = new CustomNetexValidator();\n// create a NeTEx validator runner that registers the NeTEx schema validator and the custom NeTEx validator\nNetexValidatorsRunner netexValidatorsRunner = NetexValidatorsRunner\n        .of()\n        .withNetexXMLParser(netexXMLParser)\n        .withNetexSchemaValidator(netexSchemaValidator)\n        .withXPathValidators(List.of(xPathValidator))\n        .build();\n// run the validation for a given codespace, report id, NeTEx filename and file binary content\nValidationReport validationReport = netexValidatorsRunner.validate(codespace, reportId, filename, content);\n```\n\n## Default rule set\nThe NeTEx validator library comes with the following rule set by default:\n\n| Rule Code                                |                                     Rule Description                                     |\n|------------------------------------------|:----------------------------------------------------------------------------------------:|\n| AUTHORITY_1                              |                             Authority missing CompanyNumber                              |\n| AUTHORITY_2                              |                                  Authority missing Name                                  |\n| AUTHORITY_3                              |                               Authority missing LegalName                                |\n| AUTHORITY_4                              |                             Authority missing ContactDetails                             |\n| AUTHORITY_5                              |                         Authority missing Url for ContactDetails                         |\n| BLOCK_1                                  |                            Block missing VehicleScheduleFrame                            |\n| BLOCK_2                                  |                                  Block missing Journey                                   |\n| BLOCK_3                                  |                                  Block missing DayType                                   |\n| BOOKING_1                                |                              Booking illegal BookingAccess                               |\n| BOOKING_2                                |                              Booking illegal BookingMethod                               |\n| BOOKING_3                                |                                 Booking illegal BookWhen                                 |\n| BOOKING_4                                |                                     Booking property                                     |\n| BOOKING_5                                |                         Missing BookWhen or MinimumBookingPeriod                         |\n| BUY_WHEN_1                               |                                  BuyWhen illegal value                                   |\n| COMPOSITE_FRAME_1                        |                        CompositeFrame - missing ValidityCondition                        |\n| COMPOSITE_FRAME_2                        |                    CompositeFrame - invalid nested ValidityCondition                     |\n| COMPOSITE_FRAME_3                        |                          CompositeFrame - missing ValidBetween                           |\n| COMPOSITE_FRAME_4                        |                          CompositeFrame - invalid ValidBetween                           |\n| COMPOSITE_FRAME_5                        |                      CompositeFrame - invalid AvailabilityCondition                      |\n| COMPOSITE_FRAME_6                        |                      CompositeFrame - missing AvailabilityCondition                      |\n| COMPOSITE_FRAME_SITE_FRAME               |                          CompositeFrame - unexpected SiteFrame                           |\n| COMPOSITE_TIMETABLE_FRAME_IN_COMMON_FILE |                  CompositeFrame - Illegal TimetableFrame in common file                  |\n| DATED_SERVICE_JOURNEY_1                  |                       DatedServiceJourney missing OperatingDayRef                        |\n| DATED_SERVICE_JOURNEY_2                  |                      DatedServiceJourney missing ServiceJourneyRef                       |\n| DATED_SERVICE_JOURNEY_3                  |                      DatedServiceJourney multiple ServiceJourneyRef                      |\n| DATED_SERVICE_JOURNEY_4                  |                          DatedServiceJourney multiple versions                           |\n| DATED_SERVICE_JOURNEY_5                  |         DatedServiceJourney multiple references to the same DatedServiceJourney          |\n| DEAD_RUN_1                               |                          DeadRun missing PassingTime references                          |\n| DEAD_RUN_2                               |                        DeadRun missing JourneyPattern references                         |\n| DEAD_RUN_3                               |                            DeadRun missing DayType references                            |\n| DESTINATION_DISPLAY_1                    |                           DestinationDisplay missing FrontText                           |\n| DESTINATION_DISPLAY_2                    |                 DestinationDisplay missing DestinationDisplayRef on Via                  |\n| FLEXIBLE_LINE_1                          |                          FlexibleLine missing FlexibleLineType                           |\n| FLEXIBLE_LINE_10                         |            FlexibleLine illegal use of both BookWhen and MinimumBookingPeriod            |\n| FLEXIBLE_LINE_11                         |  FlexibleLine BookWhen without LatestBookingTime or LatestBookingTime without BookWhen   |\n| FLEXIBLE_LINE_8                          |                          FlexibleLine illegal FlexibleLineType                           |\n| FLEXIBLE_LINE_9                          |                         FlexibleLine illegal FlexibleServiceType                         |\n| FLEXIBLE_SERVICE_1                       |                 FlexibleService missing Id on FlexibleServiceProperties                  |\n| FLEXIBLE_SERVICE_2                       |               FlexibleService missing version on FlexibleServiceProperties               |\n| FLEXIBLE_SERVICE_3                       |          FlexibleService illegal use of both BookWhen and MinimumBookingPeriod           |\n| FLEXIBLE_SERVICE_4                       | FlexibleService BookWhen without LatestBookingTime or LatestBookingTime without BookWhen |\n| INTERCHANGE_1                            |                              Interchange invalid properties                              |\n| INTERCHANGE_2                            |                          Interchange unexpected MaximumWaitTime                          |\n| INTERCHANGE_3                            |                          Interchange excessive MaximumWaitTime                           |\n| JOURNEY_PATTERN_1                        |                   JourneyPattern illegal element ServiceJourneyPattern                   |\n| JOURNEY_PATTERN_2                        |                          JourneyPattern missing JourneyPattern                           |\n| JOURNEY_PATTERN_3                        |                             JourneyPattern missing RouteRef                              |\n| JOURNEY_PATTERN_4                        |             JourneyPattern missing DestinationDisplayRef on first stop point             |\n| JOURNEY_PATTERN_5                        |             JourneyPattern illegal DestinationDisplayRef on last stop point              |\n| JOURNEY_PATTERN_6                        |                 JourneyPattern stop point without boarding or alighting                  |\n| JOURNEY_PATTERN_7                        |                 JourneyPattern illegal repetition of DestinationDisplay                  |\n| JOURNEY_PATTERN_8                        |          JourneyPattern  illegal use of both BookWhen and MinimumBookingPeriod           |\n| JOURNEY_PATTERN_9                        | JourneyPattern  BookWhen without LatestBookingTime or LatestBookingTime without BookWhen |\n| LINE_1                                   |                            Line missing Line or FlexibleLine                             |\n| LINE_2                                   |                                    Line missing Name                                     |\n| LINE_3                                   |                                 Line missing PublicCode                                  |\n| LINE_4                                   |                                Line missing TransportMode                                |\n| LINE_5                                   |                              Line missing TransportSubmode                               |\n| LINE_6                                   |                             Line with incorrect use of Route                             |\n| LINE_7                                   |                           Line missing Network or GroupOfLines                           |\n| LINE_8                                   |                       Invalid color coding length on Presentation                        |\n| LINE_9                                   |                        Invalid color coding value on Presentation                        |\n| NETEX_ID_1                               |                             NeTEx ID duplicated across files                             |\n| NETEX_ID_10                              |                          Duplicate NeTEx ID across common files                          |\n| NETEX_ID_5                               |                              NeTEx ID unresolved reference                               |\n| NETEX_ID_6                               |                          NeTEx ID reference to invalid element                           |\n| NETEX_ID_7                               |                                  NeTEx ID invalid value                                  |\n| NETEX_ID_8                               |                           NeTEx ID missing version on elements                           |\n| NETEX_ID_9                               |                          NeTEx ID missing version on reference                           |\n| NETWORK_1                                |                               Network missing AuthorityRef                               |\n| NETWORK_2                                |                             Network missing Name on Network                              |\n| NETWORK_3                                |                           Network missing Name on GroupOfLines                           |\n| NOTICE_1                                 |                                   Notice missing Text                                    |\n| NOTICE_2                                 |                        Notice missing Text with alternative text                         |\n| NOTICE_3                                 |                      Notice missing language with alternative text                       |\n| NOTICE_4                                 |                           Notice duplicated alternative texts                            |\n| NOTICE_5                                 |                               Notice duplicated assignment                               |\n| NOTICE_6                                 |                  Notice assignment missing reference to noticed object                   |\n| NOTICE_7                                 |                      Notice assignment missing reference to notice                       |\n| OPERATOR_1                               |                              Operator missing CompanyNumber                              |\n| OPERATOR_2                               |                                  Operator missing Name                                   |\n| OPERATOR_3                               |                                Operator missing LegalName                                |\n| OPERATOR_4                               |                             Operator missing ContactDetails                              |\n| OPERATOR_5                               |                         Operator missing Url for ContactDetails                          |\n| OPERATOR_6                               |                      Operator missing CustomerServiceContactDetails                      |\n| OPERATOR_7                               |                  Operator missing Url for CustomerServiceContactDetails                  |\n| PASSENGER_STOP_ASSIGNMENT_1              |                  PassengerStopAssignment missing ScheduledStopPointRef                   |\n| PASSENGER_STOP_ASSIGNMENT_2              |                         PassengerStopAssignment missing QuayRef                          |\n| PASSENGER_STOP_ASSIGNMENT_3              |                    PassengerStopAssignment duplicated Quay assignment                    |\n| RESOURCE_FRAME_IN_LINE_FILE              |                            ResourceFrame must be exactly one                             |\n| ROUTE_1                                  |                                      Route missing                                       |\n| ROUTE_2                                  |                                    Route missing Name                                    |\n| ROUTE_3                                  |                                  Route missing LineRef                                   |\n| ROUTE_4                                  |                              Route missing pointsInSequence                              |\n| ROUTE_5                                  |                                Route illegal DirectionRef                                |\n| ROUTE_6                                  |                                  Route duplicated order                                  |\n| SERVICE_CALENDAR_1                       |                              ServiceCalendar unused DayType                              |\n| SERVICE_CALENDAR_2                       |                          ServiceCalendar empty ServiceCalendar                           |\n| SERVICE_CALENDAR_3                       |                              ServiceCalendar missing ToDate                              |\n| SERVICE_CALENDAR_4                       |                             ServiceCalendar missing FromDate                             |\n| SERVICE_CALENDAR_5                       |                          ServiceCalendar invalid time interval                           |\n| SERVICE_FRAME_1                          |                       ServiceFrame unexpected element GroupOfLines                       |\n| SERVICE_FRAME_2                          |                       ServiceFrame unexpected element timingPoints                       |\n| SERVICE_FRAME_3                          |                      ServiceFrame missing Projection on RoutePoint                       |\n| SERVICE_FRAME_IN_COMMON_FILE_1           |                           ServiceFrame unexpected element Line                           |\n| SERVICE_FRAME_IN_COMMON_FILE_2           |                          ServiceFrame unexpected element Route                           |\n| SERVICE_FRAME_IN_COMMON_FILE_3           |                      ServiceFrame unexpected element JourneyPattern                      |\n| SERVICE_JOURNEY_1                        |                                ServiceJourney must exist                                 |\n| SERVICE_JOURNEY_10                       |                    ServiceJourney missing reference to JourneyPattern                    |\n| SERVICE_JOURNEY_11                       |                   ServiceJourney invalid overriding of transport modes                   |\n| SERVICE_JOURNEY_12                       |                            ServiceJourney missing OperatorRef                            |\n| SERVICE_JOURNEY_13                       |                    ServiceJourney missing reference to calendar data                     |\n| SERVICE_JOURNEY_14                       |                   ServiceJourney duplicated reference to calendar data                   |\n| SERVICE_JOURNEY_15                       |                        ServiceJourney missing some passing times                         |\n| SERVICE_JOURNEY_16                       |                             ServiceJourney multiple versions                             |\n| SERVICE_JOURNEY_17                       |                      Non-unique NeTEx id for TimetabledPassingTime                       |\n| SERVICE_JOURNEY_2                        |                           ServiceJourney illegal element Call                            |\n| SERVICE_JOURNEY_3                        |                       ServiceJourney missing element PassingTimes                        |\n| SERVICE_JOURNEY_4                        |                       ServiceJourney missing arrival and departure                       |\n| SERVICE_JOURNEY_5                        |                          ServiceJourney missing departure times                          |\n| SERVICE_JOURNEY_6                        |                    ServiceJourney missing arrival time for last stop                     |\n| SERVICE_JOURNEY_7                        |                      ServiceJourney identical arrival and departure                      |\n| SERVICE_JOURNEY_8                        |                    ServiceJourney missing id on TimetabledPassingTime                    |\n| SERVICE_JOURNEY_9                        |                 ServiceJourney missing version on TimetabledPassingTime                  |\n| SERVICE_LINK_1                           |                             ServiceLink missing FromPointRef                             |\n| SERVICE_LINK_2                           |                              ServiceLink missing ToPointRef                              |\n| SERVICE_LINK_3                           |                         ServiceLink missing element Projections                          |\n| SERVICE_LINK_4                           |                           ServiceLink missing coordinate list                            |\n| SERVICE_LINK_5                           |                              ServiceLink less than 2 points                              |\n| SITE_FRAME_IN_COMMON_FILE                |                      SiteFrame unexpected SiteFrame in Common file                       |\n| SITE_FRAME_IN_LINE_FILE                  |                       SiteFrame unexpected SiteFrame in Line file                        |\n| TIMETABLE_FRAME_IN_COMMON_FILE           |                          TimetableFrame illegal in Common file                           |\n| TRANSPORT_MODE_ON_LINE                   |                                Line Illegal TransportMode                                |\n| TRANSPORT_MODE_ON_SERVICE_JOURNEY        |                          Service Journey Illegal TransportMode                           |\n| TRANSPORT_SUB_MODE_ON_LINE               |                              Line Illegal TransportSubMode                               |\n| TRANSPORT_SUB_MODE_ON_SERVICE_JOURNEY    |                         Service Journey Illegal TransportSubMode                         |\n| VALIDITY_CONDITIONS_IN_COMMON_FILE_1     |            ValidityConditions missing in ServiceFrame or ServiceCalendarFrame            |\n| VALIDITY_CONDITIONS_IN_COMMON_FILE_2     |                       ValidityConditions missing in ResourceFrames                       |\n| VALIDITY_CONDITIONS_IN_COMMON_FILE_3     |                       ValidityConditions missing in ServiceFrames                        |\n| VALIDITY_CONDITIONS_IN_COMMON_FILE_4     |                   ValidityConditions missing in ServiceCalendarFrames                    |\n| VALIDITY_CONDITIONS_IN_LINE_FILE_1       |                         ValidityConditions missing in all frames                         |\n| VALIDITY_CONDITIONS_IN_LINE_FILE_2       |                       ValidityConditions missing in ServiceFrames                        |\n| VALIDITY_CONDITIONS_IN_LINE_FILE_3       |                   ValidityConditions missing in ServiceCalendarFrames                    |\n| VALIDITY_CONDITIONS_IN_LINE_FILE_4       |                      ValidityConditions missing in TimeTableFrames                       |\n| VALIDITY_CONDITIONS_IN_LINE_FILE_5       |                    ValidityConditions missing in VehicleScheduleFrame                    |\n| VERSION_NON_NUMERIC                      |                                Non-numeric NeTEx version                                 |\n\n## Command-line interface\nThe library can be used as a command-line tool to validate NeTEx datasets.\n\n```\nUsage: ./validate-netex.sh [-d] [-v] \u003cfile1\u003e [file2] [file3] ...\n\nSupports single NeTEx XML files and ZIP archives containing multiple NeTEx files.\nAll files are validated sequentially in the same session.\n\nOptions:\n  -d    Enable debug output\n  -v    Show detailed validation issues instead of summary\n  -h    Show this help message\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fentur%2Fnetex-validator-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fentur%2Fnetex-validator-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fentur%2Fnetex-validator-java/lists"}