+
Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Oct 6, 2025

Problem

Users were unable to determine which SPS (SciELO Publishing Schema) version was being used for validation when running stylechecker. This information was only available when using --loglevel INFO, which also produced verbose debug output. This led to confusion about:

  • Which schema version was actually being validated
  • Whether --extrasch @sps-1.10 was needed to validate against the latest version
  • The difference between automatic schema detection and additional schema validation

Closes #[issue_number]

Solution

Added a sps_version field to the validation summary output. The SPS version is automatically detected from the XML file's specific-use attribute and is now included in all validation results.

Changes

  • Modified packtools/stylechecker.py to include sps_version in the summary dictionary
  • Updated .gitignore to exclude *.annotated.xml files

Example Output

Before:

{
  "_xml": "file.xml",
  "assets": [],
  "dtd_errors": [],
  "is_valid": true,
  "style_errors": {}
}

After:

{
  "_xml": "file.xml",
  "assets": [],
  "dtd_errors": [],
  "is_valid": true,
  "sps_version": "sps-1.9",
  "style_errors": {}
}

Benefits

  • Clear visibility: Users can immediately see which SPS schema version is being validated
  • No breaking changes: Adds a new field without modifying existing output structure
  • Works everywhere: Available in both formatted and raw JSON output modes
  • Clarifies behavior: Makes it clear that the schema is auto-detected from the XML, and --extrasch is for additional validations

Usage

# The output now shows which SPS version is being validated
stylechecker file.xml

# Example output snippet:
# "sps_version": "sps-1.9"

# The --extrasch option adds ADDITIONAL validations beyond the auto-detected one
stylechecker --extrasch @sps-1.10 file.xml
# This validates against BOTH sps-1.9 (from XML) AND sps-1.10 (additional)

Testing

  • All existing tests pass (84 tests)
  • Verified with multiple XML files using different SPS versions (sps-1.8, sps-1.9)
  • Tested with all output modes (formatted, raw JSON, annotated)
Original prompt

This section details on the original issue you should resolve

<issue_title>[dúvida] informação do schema validado</issue_title>
<issue_description>### Descrição do problema
Não está claro usando o packtools stylechecker qual o schema que ele está validando. Seria o sps-1.10?

No help, --extrasch:

runs an extra validation using an external schematron schema. built-in schemas are available through the prefix `@`: @scielo-br, @sps-1.1, @sps-1.10, @sps-1.2, @sps-1.3, @sps-1.4, @sps-1.5, @sps-1.6, @sps-1.7, @sps-1.8, @sps-1.9.

é preciso colocar --extrasch @sps-1.10 para checar na última versão? (sps-1.10 é a última versão, vi referência a sps-1.11 em um repo aqui do scieloorg).

Passos para reproduzir o problema

stylechecker --annotated --loglevel INFO file.xml
ou
stylechecker --annotated --loglevel INFO --extrasch @sps-1.10 file.xml

Comportamento esperado

Alguma informação do Schema que está sendo utilizado para validar o xml.

Ambiente utilizado

stylechecker --version
4.11.22rc20250905</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #1028

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits October 6, 2025 13:05
Co-authored-by: robertatakenaka <505143+robertatakenaka@users.noreply.github.com>
Co-authored-by: robertatakenaka <505143+robertatakenaka@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] [dúvida] informação do schema validado Add SPS schema version to validation output Oct 6, 2025
Copilot finished work on behalf of robertatakenaka October 6, 2025 13:09
@Copilot Copilot AI requested a review from robertatakenaka October 6, 2025 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[dúvida] informação do schema validado

2 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载